Uploaded image for project: 'Maven Assembly Plugin'
  1. Maven Assembly Plugin
  2. MASSEMBLY-565

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.1
    • 2.5.2
    • predefined descriptors
    • None

    Description

      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.

      Attachments

        1. maven_bug_build_override_class.zip
          5 kB
          Jean-Marc Vanel

        Issue Links

          Activity

            People

              krosenvold Kristian Rosenvold
              jmvanel Jean-Marc Vanel
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: