PR: MNG-229

- always use super POM's repository for parent resolution
- use correct repository set for plugin dependency resolution

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@220102 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-07-21 15:15:54 +00:00
parent 511af3d3e2
commit 6aa208414f
2 changed files with 18 additions and 25 deletions

View File

@ -51,8 +51,8 @@ import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.artifact.MavenMetadataSource;
import org.apache.maven.project.path.PathTranslator;
import org.apache.maven.settings.Settings;
import org.apache.maven.reporting.MavenReport;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusContainerException;
@ -344,7 +344,8 @@ public class DefaultPluginManager
public List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session,
ArtifactRepository localRepository )
throws PluginManagerException, PluginVersionResolutionException, PluginConfigurationException, ArtifactResolutionException
throws PluginManagerException, PluginVersionResolutionException, PluginConfigurationException,
ArtifactResolutionException
{
Plugin forLookup = new Plugin();
forLookup.setGroupId( reportPlugin.getGroupId() );
@ -359,7 +360,6 @@ public class DefaultPluginManager
MojoDescriptor mojoDescriptor = (MojoDescriptor) i.next();
// TODO: check ID is correct for reports
// TODO: this returns mojos that aren't reports
// if the POM configured no reports, give all from plugin
if ( reportSet == null || reportSet.getReports().contains( mojoDescriptor.getGoal() ) )
{
@ -476,11 +476,6 @@ public class DefaultPluginManager
{
MavenMetadataSource metadataSource = new MavenMetadataSource( mavenProjectBuilder, artifactFactory );
List remoteRepositories = new ArrayList();
remoteRepositories.addAll( project.getRemoteArtifactRepositories() );
remoteRepositories.addAll( project.getPluginArtifactRepositories() );
ArtifactRepository localRepository = session.getLocalRepository();
ResolutionGroup resolutionGroup = metadataSource.retrieve( pluginArtifact, localRepository,
@ -490,7 +485,7 @@ public class DefaultPluginManager
ArtifactResolutionResult result = artifactResolver.resolveTransitively( dependencies, pluginArtifact,
localRepository,
remoteRepositories,
resolutionGroup.getResolutionRepositories(),
metadataSource,
artifactFilter );
@ -549,7 +544,8 @@ public class DefaultPluginManager
if ( artifactFile == null )
{
String resource = "/META-INF/maven/" + artifact.getGroupId() + "/" + artifact.getArtifactId() + "/pom.xml";
String resource = "/META-INF/maven/" + artifact.getGroupId() + "/" + artifact.getArtifactId() +
"/pom.xml";
URL resourceUrl = container.getContainerRealm().getResource( resource );

View File

@ -283,18 +283,16 @@ public class DefaultMavenProjectBuilder
LinkedList lineage = new LinkedList();
List aggregatedRemoteWagonRepositories;
if ( remoteArtifactRepositories == null || remoteArtifactRepositories.isEmpty() )
Set aggregatedRemoteWagonRepositories = new HashSet();
if ( remoteArtifactRepositories != null && !remoteArtifactRepositories.isEmpty() )
{
aggregatedRemoteWagonRepositories = ProjectUtils.buildArtifactRepositories( superModel.getRepositories(),
artifactRepositoryFactory,
container );
}
else
{
aggregatedRemoteWagonRepositories = new ArrayList( remoteArtifactRepositories );
aggregatedRemoteWagonRepositories.addAll( remoteArtifactRepositories );
}
aggregatedRemoteWagonRepositories.addAll( ProjectUtils.buildArtifactRepositories( superModel.getRepositories(),
artifactRepositoryFactory,
container ) );
for ( Iterator i = externalProfiles.iterator(); i.hasNext(); )
{
Profile externalProfile = (Profile) i.next();
@ -307,14 +305,13 @@ public class DefaultMavenProjectBuilder
artifactRepositoryFactory,
container );
if ( !aggregatedRemoteWagonRepositories.contains( artifactRepo ) )
{
aggregatedRemoteWagonRepositories.add( artifactRepo );
}
aggregatedRemoteWagonRepositories.add( artifactRepo );
}
}
MavenProject project = assembleLineage( model, lineage, aggregatedRemoteWagonRepositories, localRepository );
List repositories = new ArrayList( aggregatedRemoteWagonRepositories );
MavenProject project = assembleLineage( model, lineage, repositories, localRepository );
// we don't have to force the collision exception for superModel here, it's already been done in getSuperModel()
Model previous = superModel;
@ -332,7 +329,7 @@ public class DefaultMavenProjectBuilder
try
{
project = processProjectLogic( pomLocation, project, aggregatedRemoteWagonRepositories, externalProfiles );
project = processProjectLogic( pomLocation, project, repositories, externalProfiles );
}
catch ( ModelInterpolationException e )
{