jar-with-dependencies: class from the source in project does NOT override the 
class in jar dependency
-----------------------------------------------------------------------------------------------------

                 Key: MASSEMBLY-565
                 URL: https://jira.codehaus.org/browse/MASSEMBLY-565
             Project: Maven 2.x Assembly Plugin
          Issue Type: Bug
    Affects Versions: 2.2.1
         Environment: % mvn -version
Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: /home/jmv/apps/apache-maven3
Java version: 1.6.0_25, vendor: Sun Microsystems Inc.
Java home: /home/jmv/apps/jdk1.6.0_25/jre
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "2.6.38-10-generic", arch: "amd64", family: "unix"
            Reporter: Jean-Marc Vanel
         Attachments: maven_bug_build_override_class.zip

When running plugin maven-assembly-plugin 2.2.1 with jar-with-dependencies, and 
there is a class C1 in src/main/java/ that overrides a class C1 in some 
dependency, in the resulting XXX-jar-with-dependencies.jar the C1.class comes 
from the dependency, not from the source in project.
I would except the class from the source in project to override the 
corresponding class in jar dependency,
So the executable jar is not built correctly. This is particularly annoying, 
because the tests pass, but the executable jar is not correct.

You can see this in the test project attached, where I override class TestCase 
of JUnit , adding a main , and setting this overriden class as the main class:

% java -jar 
target/maven_bug_build_override_class-1.0-SNAPSHOT-jar-with-dependencies.jar
Exception in thread "main" java.lang.NoSuchMethodError: main
( the original class TestCase of JUnit has no main ).

In the test project attached,I kept all the Maven plugins that are in my 
original project, because they might have a relation with the issue.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to