Skip to content

Fixes for classpath handling for scala script. #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

akshaal
Copy link
Contributor

@akshaal akshaal commented Apr 10, 2014

When constructing class:

  1. Take dependency management into account. Use maven's transient dependency traverse methods.
  2. Avoid different jar versions in the class path (porject's pom ones win, otherwise newer one wins).
  3. Don't fail with LinkageError exception for org/codehaus/plexus/

classpath before this patch:
[DEBUG] classpath entry for running and compiling scripts: /home/akshaal/.m2/repository/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.jar
[DEBUG] classpath entry for running and compiling scripts: /home/akshaal/.m2/repository/org/apache/maven/maven-artifact/2.0.8/maven-artifact-2.0.8.jar
[DEBUG] classpath entry for running and compiling scripts: /home/akshaal/.m2/repository/org/apache/maven/maven-artifact/2.2.1/maven-artifact-2.2.1.jar
[DEBUG] classpath entry for running and compiling scripts: /home/akshaal/.m2/repository/org/apache/maven/maven-artifact/3.0.4/maven-artifact-3.0.4.jar
[DEBUG] classpath entry for running and compiling scripts: /home/akshaal/.m2/repository/org/apache/maven/maven-core/2.0.6/maven-core-2.0.6.jar
[DEBUG] classpath entry for running and compiling scripts: /home/akshaal/.m2/repository/org/apache/maven/maven-core/3.0.4/maven-core-3.0.4.jar
[DEBUG] classpath entry for running and compiling scripts: /home/akshaal/.m2/repository/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar
[DEBUG] classpath entry for running and compiling scripts: /home/akshaal/.m2/repository/classworlds/classworlds/1.1/classworlds-1.1.jar
......

classpath after this patch:
[DEBUG] classpath entry for running and compiling scripts: /home/akshaal/.m2/repository/org/apache/maven/maven-artifact/2.2.1/maven-artifact-2.2.1.jar
[DEBUG] classpath entry for running and compiling scripts: /home/akshaal/.m2/repository/org/apache/maven/maven-core/3.0.4/maven-core-3.0.4.jar
[DEBUG] classpath entry for running and compiling scripts: /home/et1055/.m2/repository/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar
.....

Also fixes:
Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.1.6:script (default-cli) on project blahblahblah:
wrap: java.lang.Exception: A LinkageError exception was thrown: loader constraint violation: when resolving interface
method "org.apache.maven.shared.invoker.InvocationResult.getExecutionException()Lorg/codehaus/plexus/util/cli/CommandLineException;"
the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) of the current class, CommonMavenHelper,
and the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) for resolved class,
org/apache/maven/shared/invoker/InvocationResult, have different Class objects for the type
org/codehaus/plexus/util/cli/CommandLineException used in the signature -> [Help 1]

When constructing class:
1. Take dependency management into consideration. Use maven's transient dependency traverse methods.
2. Avoid different jar versions in the class path (porject's pom ones win, otherwise newer one wins).
3. Don't fail with LinkageError exception for org/codehaus/plexus/
@davidB
Copy link
Owner

davidB commented Apr 11, 2014

Hi,

Do you have a same project that show the issue and the fix ?
Then it could be included as integration test (under src/it)

@davidB
Copy link
Owner

davidB commented Feb 14, 2018

obsolete

@davidB davidB closed this Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants