[ https://jira.codehaus.org/browse/MNG-5787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=365731#comment-365731 ]
Christian Schlichtherle edited comment on MNG-5787 at 3/26/15 10:54 AM: ------------------------------------------------------------------------ Here is an effective work-around: Add the maven-shade-plugin to the plugin POM and make sure to declare the scope of the maven-plugin-annotations and the maven-plugin-api as provided. The maven-shade-plugin creates an Uber JAR for the plugin which includes the slf4j-api. This runs fine with both Maven 3.3.1 and Maven 3.2.5. was (Author: christian_schlichtherle): Here is an effective work-around: Add the maven-shade-plugin to the plugin POM and make sure to declare the scope of the maven-plugin-annotations and the maven-plugin-api as provided. Th maven-shade-plugin creates an Uber JAR for the plugin which includes the slf4j-api. This runs fine with both Maven 3.3.1 and Maven 3.2.5. > Maven 3.3.1 breaks plugins with the SLF4J API on the class path > --------------------------------------------------------------- > > Key: MNG-5787 > URL: https://jira.codehaus.org/browse/MNG-5787 > Project: Maven > Issue Type: Bug > Components: Class Loading > Affects Versions: 3.3.1 > Environment: OS X 10.10.2, JDK 1.7.0_76 and JDK 1.8.0_40. > Reporter: Christian Schlichtherle > Priority: Blocker > Attachments: hello-maven-plugin.zip > > > There is a regression when setting up the class path for a plugin in Maven > 3.3.1. The following commands run fine when using Maven 3.2.5 or older: > {code} > $ mvn --version > Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; > 2014-12-14T18:29:23+01:00) > Maven home: /usr/local/Cellar/maven/3.2.5/libexec > Java version: 1.8.0_40, vendor: Oracle Corporation > Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre > Default locale: de_DE, platform encoding: UTF-8 > OS name: "mac os x", version: "10.10.2", arch: "x86_64", family: "mac" > $ mvn archetype:generate \ > -DarchetypeGroupId=net.java.truelicense \ > -DarchetypeArtifactId=truelicense-maven-archetype \ > -DarchetypeVersion=2.3.4 \ > -DgroupId=com.company.product \ > -DartifactId=product \ > -Dversion=0.1-SNAPSHOT \ > -Dpackage=com.company.product \ > -Dsubject="Product 1" > [...] > $ cd project > $ mvn clean install > [...] > {code} > Note that I have shortened the output using bracketed ellipsis {{\[...\]}}. > However, when running the same commands using Maven 3.3.1, I get the > following output: > {code} > $ mvn --version > Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; > 2015-03-13T21:10:27+01:00) > Maven home: /Users/christian/Downloads/apache-maven-3.3.1 > Java version: 1.8.0_40, vendor: Oracle Corporation > Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre > Default locale: de_DE, platform encoding: UTF-8 > OS name: "mac os x", version: "10.10.2", arch: "x86_64", family: "mac" > $ mvn archetype:generate \ > -DarchetypeGroupId=net.java.truelicense \ > -DarchetypeArtifactId=truelicense-maven-archetype \ > -DarchetypeVersion=2.3.4 \ > -DgroupId=com.company.product \ > -DartifactId=product \ > -Dversion=0.1-SNAPSHOT \ > -Dpackage=com.company.product \ > -Dsubject="Product 1" > [...] > $ cd project > $ mvn clean install > [INFO] Scanning for projects... > [INFO] > ------------------------------------------------------------------------ > [INFO] Reactor Build Order: > [INFO] > [INFO] product > [INFO] keygen > [INFO] keymgr > [INFO] keysrv > [INFO] > > [INFO] > ------------------------------------------------------------------------ > [INFO] Building product 0.1-SNAPSHOT > [INFO] > ------------------------------------------------------------------------ > [INFO] > [INFO] --- maven-clean-plugin:2.6:clean (default-clean) @ product --- > [INFO] > [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven) @ product --- > [INFO] > [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ product --- > [INFO] Installing /Users/christian/sandbox/truelicense/product/pom.xml to > /Users/christian/.m2/repository/com/company/product/product/0.1-SNAPSHOT/product-0.1-SNAPSHOT.pom > [INFO] > > [INFO] > ------------------------------------------------------------------------ > [INFO] Building keygen 0.1-SNAPSHOT > [INFO] > ------------------------------------------------------------------------ > [INFO] > [INFO] --- maven-clean-plugin:2.6:clean (default-clean) @ keygen --- > [INFO] Deleting /Users/christian/sandbox/truelicense/product/keygen/target > [INFO] > [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven) @ keygen --- > [INFO] > [INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ keygen > --- > [INFO] Using 'US-ASCII' encoding to copy filtered resources. > [INFO] Copying 1 resource > [INFO] Copying 1 resource > [INFO] > [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ keygen --- > [INFO] Changes detected - recompiling the module! > [INFO] Compiling 2 source files to > /Users/christian/sandbox/truelicense/product/keygen/target/classes > [INFO] > [INFO] --- truelicense-maven-plugin:2.3.4:obfuscate (default) @ keygen --- > [INFO] Obfuscating annotated constant string values in > /Users/christian/sandbox/truelicense/product/keygen/target/classes. > [INFO] > ------------------------------------------------------------------------ > [INFO] Reactor Summary: > [INFO] > [INFO] product ............................................ SUCCESS [ 0.411 > s] > [INFO] keygen ............................................. FAILURE [ 1.022 > s] > [INFO] keymgr ............................................. SKIPPED > [INFO] keysrv ............................................. SKIPPED > [INFO] > ------------------------------------------------------------------------ > [INFO] BUILD FAILURE > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 1.646 s > [INFO] Finished at: 2015-03-18T19:31:46+01:00 > [INFO] Final Memory: 15M/245M > [INFO] > ------------------------------------------------------------------------ > [ERROR] Failed to execute goal > net.java.truelicense:truelicense-maven-plugin:2.3.4:obfuscate (default) on > project keygen: Execution default of goal > net.java.truelicense:truelicense-maven-plugin:2.3.4:obfuscate failed: A > required class was missing while executing > net.java.truelicense:truelicense-maven-plugin:2.3.4:obfuscate: > org/slf4j/helpers/MarkerIgnoringBase > [ERROR] ----------------------------------------------------- > [ERROR] realm = plugin>net.java.truelicense:truelicense-maven-plugin:2.3.4 > [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy > [ERROR] urls[0] = > file:/Users/christian/.m2/repository/net/java/truelicense/truelicense-maven-plugin/2.3.4/truelicense-maven-plugin-2.3.4.jar > [ERROR] urls[1] = > file:/Users/christian/.m2/repository/net/java/truelicense/truelicense-obfuscate/2.3.4/truelicense-obfuscate-2.3.4.jar > [ERROR] urls[2] = > file:/Users/christian/.m2/repository/de/schlichtherle/truezip/truezip-driver-zip/7.7.6/truezip-driver-zip-7.7.6.jar > [ERROR] urls[3] = > file:/Users/christian/.m2/repository/de/schlichtherle/truezip/truezip-swing/7.7.6/truezip-swing-7.7.6.jar > [ERROR] urls[4] = > file:/Users/christian/.m2/repository/org/apache/commons/commons-compress/1.9/commons-compress-1.9.jar > [ERROR] urls[5] = > file:/Users/christian/.m2/repository/de/schlichtherle/truezip/truezip-kernel/7.7.6/truezip-kernel-7.7.6.jar > [ERROR] urls[6] = > file:/Users/christian/.m2/repository/de/schlichtherle/truezip/truezip-file/7.7.6/truezip-file-7.7.6.jar > [ERROR] urls[7] = > file:/Users/christian/.m2/repository/de/schlichtherle/truezip/truezip-driver-file/7.7.6/truezip-driver-file-7.7.6.jar > [ERROR] urls[8] = > file:/Users/christian/.m2/repository/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.jar > [ERROR] urls[9] = > file:/Users/christian/.m2/repository/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar > [ERROR] urls[10] = > file:/Users/christian/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar > [ERROR] Number of foreign imports: 1 > [ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]] > [ERROR] > [ERROR] -----------------------------------------------------: > org.slf4j.helpers.MarkerIgnoringBase > [ERROR] -> [Help 1] > [ERROR] > [ERROR] To see the full stack trace of the errors, re-run Maven with the -e > switch. > [ERROR] Re-run Maven using the -X switch to enable full debug logging. > [ERROR] > [ERROR] For more information about the errors and possible solutions, please > read the following articles: > [ERROR] [Help 1] > http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException > [ERROR] > [ERROR] After correcting the problems, you can resume the build with the > command > [ERROR] mvn <goals> -rf :keygen > {code} > {{org.slf4j.helpers.MarkerIgnoringBase}} is a class in the SLF4J API. Version > 1.7.7 is a compile dependency of the TrueLicense Maven Plugin, as can be seen > at > https://repo1.maven.org/maven2/net/java/truelicense/truelicense-maven-plugin/2.3.4/truelicense-maven-plugin-2.3.4.pom > , however it is apparently missing on the class path when building the > project with Maven 3.3.1. > Using a 1.7 JDK makes no difference, too. -- This message was sent by Atlassian JIRA (v6.1.6#6162)