Uploaded image for project: 'Maven Dependency Plugin'
  1. Maven Dependency Plugin
  2. MDEP-1

multi-module builds don't unpack-dependencies with dependency-maven-plugin:1.0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0-alpha-1
    • None
    • None
    • I'm running on Windows 2003 Server, but I don't think it's specific to that.

    Description

      There seems to be a bug in the dependency-maven-plugin that causes multi-module (inheritance) Maven builds to break.

      In the project I'm working on, I'm using "unpack-dependencies" to unpack the dependencies into ${project.build.directory}/classes. This allows me to re-bundle my dependency jars into a single jar, for easier distribution.

      I've attached a zip file with an example project. In this project, there's a top-level project called "unpackbug" and three sub-level projects, "one", "two" and "three".

      "one" --> "two" --> "three"

      "one" provides One.java, and has no dependencies. "two" depends on "one", and uses dependency-maven-plugin to unpack dependencies, in order to re-bundle "one" in two.jar. Furthermore, "two" depends on "one" at the "provided" scope, in order to ensure that anyone who depends on "two" doesn't get an extra copy of "one"; they should only get the copy of "one" bundled with "two".

      "three" depends on "two", but does not depend on "one".

      If you run "mvn install" from the top-level, the build will fail, because "three" can't find "One.java". If you check the repository, you'll find that two-1.0-SNAPSHOT.jar does not have a copy of One.java in it.

      But if you go down into "two" and run "mvn install" in there, you'll find that two-1.0-SNAPSHOT.jar does have a copy of One.java in it. Now our build of "three" will succeed. You can now go back up to the top and run "mvn install" from the top and it will work.

      I've watched this happen in a debugger... The problem here is that MavenProject.getArtifacts() (for some reason) doesn't return any artifacts for "one" when running in a multi-module build, but it does return artifacts for "one" when running in a single-module build of "two".

      I haven't attached a JUnit test case, but I have attached an example test project, which I hope counts as "testcase included".

      Attachments

        1. unpackbug.zip
          254 kB
          Daniel Fabulich

        Issue Links

          Activity

            People

              brianf Brian E Fox
              dfabulich Daniel Fabulich
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: