Transitive dependencies of excluded artifacts are included in the .classpath 
file
---------------------------------------------------------------------------------

                 Key: MECLIPSE-522
                 URL: http://jira.codehaus.org/browse/MECLIPSE-522
             Project: Maven 2.x Eclipse Plugin
          Issue Type: Bug
          Components: Core : Dependencies resolution and build path (.classpath)
    Affects Versions: 2.5.1
         Environment: Wndows XP, JDK 5 u12
            Reporter: Yousuf Haider
         Attachments: AbstractIdeSupportMojo.java

If an artifact is set in the excludes list its transitive dependencies are not 
excluded from the .classpath.

The issue lies in AbstractIdeSupportMojo where the doDependencyResolution() 
method checks that for each resolved artifact whether or not the artifact name 
(using this notation groupId:artifactId) is in the excludes List.

Dependencies resolved using ArtifactCollector contain transitive dependencies 
which do not get excluded using the above mentioned mechanism.

Proposed solution  for this is to use ExcludeArtifactFilter and pass it on to 
the AritfactCollector in doDependency() method
i.e instead of doing this :

{{artifactResolutionResult = artifactCollector.collect( getProjectArtifacts(), 
project.getArtifact(), managedVersions, localRepo, 
project.getRemoteArtifactRepositories(), getArtifactMetadataSource(), *null*, 
listeners );}}

We could do this:

{{*ArtifactFilter filter = new ExcludesArtifactFilter(getExcludes());*}}
{{artifactResolutionResult = artifactCollector.collect( getProjectArtifacts(), 
project.getArtifact(), managedVersions, localRepo, 
project.getRemoteArtifactRepositories(), getArtifactMetadataSource(), *filter*, 
listeners );}}

This way the resovledDependencies don't contain the excluded artifacts as well 
as any transitive dependencies. Also it lets the ArtifactCollector  to manage 
the exclusion instead of this plugin doing it itself.

Attaching the patched version of AbstractIdeSupportMojo.java



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to