[MNG-3410] Managed versions in plugins are not considered when using them

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@632683 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Carlos Sanchez Gonzalez 2008-03-02 00:55:14 +00:00
parent 667d800240
commit b19a751704
1 changed files with 20 additions and 1 deletions

View File

@ -54,6 +54,7 @@ import org.apache.maven.plugin.version.PluginVersionResolutionException;
import org.apache.maven.project.DuplicateArtifactAttachmentException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.apache.maven.project.artifact.MavenMetadataSource;
import org.apache.maven.project.path.PathTranslator;
@ -84,6 +85,7 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
@ -390,6 +392,23 @@ public class DefaultPluginManager
pluginArtifact, e );
}
/* get plugin managed versions */
Map pluginManagedDependencies = new HashMap();
try
{
MavenProject pluginProject =
mavenProjectBuilder.buildFromRepository( pluginArtifact, project.getRemoteArtifactRepositories(),
localRepository );
if ( pluginProject != null )
{
pluginManagedDependencies = pluginProject.getManagedVersionMap();
}
}
catch ( ProjectBuildingException e )
{
// this can't happen, it would have blowed up at artifactMetadataSource.retrieve()
}
// checkPlexusUtils( resolutionGroup, artifactFactory );
Set dependencies = new LinkedHashSet();
@ -409,7 +428,7 @@ public class DefaultPluginManager
ArtifactResolutionResult result = artifactResolver.resolveTransitively(
dependencies,
pluginArtifact,
Collections.EMPTY_MAP,
pluginManagedDependencies,
localRepository,
repositories.isEmpty()
? Collections.EMPTY_LIST