Assembly does not use same dependencies as Maven 3.x itself -----------------------------------------------------------
Key: MASSEMBLY-575 URL: https://jira.codehaus.org/browse/MASSEMBLY-575 Project: Maven 2.x Assembly Plugin Issue Type: Bug Affects Versions: 2.2.1 Environment: Maven 3.0.3 JDK 1.6.0_20 on Linux x86_64 Reporter: David Tombs Attachments: sample-project.tar.gz The dependencies used by <dependencySet> do not match Maven 3's updated dependency resolution used in compilation, etc. Please see the attached project for an example. When you run 'mvn -X package', you can see that Maven prints the following dependency tree: [DEBUG] sample:sample-project:jar:1.0-SNAPSHOT [DEBUG] org.apache.camel:camel-core:jar:2.8.0:compile [DEBUG] org.slf4j:slf4j-api:jar:1.6.1:compile [DEBUG] org.fusesource.commonman:commons-management:jar:1.0:compile [DEBUG] com.sun:tools:jar:1.5.0:system [DEBUG] org.apache.camel:camel-spring:jar:2.8.0:compile [DEBUG] org.springframework:spring-aop:jar:3.0.5.RELEASE:compile [DEBUG] aopalliance:aopalliance:jar:1.0:compile [DEBUG] org.springframework:spring-tx:jar:3.0.5.RELEASE:compile [DEBUG] org.springframework:spring-context:jar:3.0.6.RELEASE:compile [DEBUG] org.springframework:spring-beans:jar:3.0.6.RELEASE:compile [DEBUG] org.springframework:spring-core:jar:3.0.6.RELEASE:compile [DEBUG] commons-logging:commons-logging:jar:1.1.1:compile [DEBUG] org.springframework:spring-expression:jar:3.0.6.RELEASE:compile [DEBUG] org.springframework:spring-asm:jar:3.0.6.RELEASE:compile [DEBUG] org.slf4j:slf4j-log4j12:jar:1.6.1:compile [DEBUG] log4j:log4j:jar:1.2.16:compile While the assembly plugin uses the following: [DEBUG] sample:sample-project:jar:1.0-SNAPSHOT (selected for null) [DEBUG] org.apache.camel:camel-core:jar:2.8.0:compile (selected for compile) [DEBUG] org.slf4j:slf4j-api:jar:1.6.1:compile (selected for compile) [DEBUG] org.fusesource.commonman:commons-management:jar:1.0:compile (selected for compile) [DEBUG] com.sun:tools:jar:1.5.0:system (selected for system) [DEBUG] org.apache.camel:camel-spring:jar:2.8.0:compile (selected for compile) [DEBUG] org.springframework:spring-context:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] org.springframework:spring-aop:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] aopalliance:aopalliance:jar:1.0:compile (selected for compile) [DEBUG] org.springframework:spring-asm:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] org.springframework:spring-beans:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] org.springframework:spring-core:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] commons-logging:commons-logging:jar:1.1.1:compile (selected for compile) [DEBUG] org.springframework:spring-core:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] commons-logging:commons-logging:jar:1.1.1:compile (selected for compile) [DEBUG] org.springframework:spring-beans:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] org.springframework:spring-core:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] commons-logging:commons-logging:jar:1.1.1:compile (selected for compile) [DEBUG] org.springframework:spring-expression:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] org.springframework:spring-asm:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] org.springframework:spring-aop:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] aopalliance:aopalliance:jar:1.0:compile (selected for compile) [DEBUG] org.springframework:spring-tx:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] org.springframework:spring-context:jar:3.0.6.RELEASE:compile (range restricted from: [3.0.0.RELEASE,) and: 3.0. [DEBUG] org.springframework:spring-context:jar:3.0.5.RELEASE:compile (selected for compile) [DEBUG] org.springframework:spring-aop:jar:3.0.6.RELEASE:compile (removed - nearer found: 3.0.5.RELEASE) [DEBUG] org.springframework:spring-beans:jar:3.0.6.RELEASE:compile (selected for compile) [DEBUG] org.springframework:spring-core:jar:3.0.6.RELEASE:compile (selected for compile) [DEBUG] org.springframework:spring-asm:jar:3.0.6.RELEASE:compile (selected for compile) [DEBUG] commons-logging:commons-logging:jar:1.1.1:compile (selected for compile) [DEBUG] org.springframework:spring-core:jar:3.0.6.RELEASE:compile (selected for compile) [DEBUG] org.springframework:spring-asm:jar:3.0.6.RELEASE:compile (selected for compile) [DEBUG] commons-logging:commons-logging:jar:1.1.1:compile (selected for compile) [DEBUG] org.springframework:spring-expression:jar:3.0.6.RELEASE:compile (selected for compile) [DEBUG] org.springframework:spring-asm:jar:3.0.6.RELEASE:compile (selected for compile) [DEBUG] org.slf4j:slf4j-log4j12:jar:1.6.1:compile (selected for compile) [DEBUG] log4j:log4j:jar:1.2.16:compile (selected for compile) [DEBUG] log4j:log4j:jar:1.2.16:compile (selected for compile) Note that spring-context is 3.0.6.RELEASE in the first tree, and 3.0.5.RELEASE in the second tree. The end result of this is that the produced JAR Manifest's Class-Path entry refers spring-context-3.0.6.RELEASE.jar while the actual JAR present is spring-context-3.0.5.RELEASE.jar. So running 'java -jar' fails with: Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/support/AbstractApplicationContext Caused by: java.lang.ClassNotFoundException: org.springframework.context.support.AbstractApplicationContext at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: org.apache.camel.spring.Main. Program will exit. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira