Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-4961

CLONE -Dependency exclusions not always honored for dependencies with classifier

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Duplicate
    • 2.2.1
    • None
    • Dependencies
    • None
    • Windows 7 64bit, Java 1.6 32bit

    Description

      Like the summary says, I've encountered and tracked down a bug that prevents dependency exclusions from being honored by plugins when the dependency with the exclusions has a classifier. This seems to only occur or surface in multi-module builds.

      For example, I have a multi-module project structured as follows:

      myproj-parent
        myproj-a
        myproj-b
      

      If myproj-a produces a classified artifact (say, an obfuscated JAR via ProGuard) and myproj-b has it as a dependency with exclusions, those exclusions will not be honored by plugins run in myproj-b (say, the webstart plugin).

      I think I've tracked the problem down to the replaceWithActiveArtifact(...) method of org.apache.maven.project.MavenProject. Specifically, see lines 1772 through 1784. The following if clause does not account for artifacts with classifiers:

      if ( ref.getArtifact() != null
           && ref.getArtifact().getDependencyConflictId().equals( pluginArtifact.getDependencyConflictId() ) )
      

      Because the classified pluginArtifact does not match the main artifact of ref, the artifact is not resolved from the currently building project's dependencies. As the method continues, it is instead resolved with myproj-a's "standard" metadata, which of course don't include the exclusions in myproj-b.

      I've marked this bug a blocker because I can't think of a way around it and it's badly polluting one of my project's builds. Due to it, a webstart build that only needs 30 artifacts has over 100. I have not yet tried to reproduce it in Maven 3.x because our company likely won't be moving to it for a couple of months.

      Attachments

        Issue Links

          Activity

            People

              bentmann Benjamin Bentmann
              sunil.dhage@symphonysv.com Sunil Kumar Dhage
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: