Repositories defined in a profile are ignored while processing dependency
management pom imports in a pom resolved from the repository
--------------------------------------------------------------------------------------------------------------------------------------
Key: MRELEASE-602
URL: http://jira.codehaus.org/browse/MRELEASE-602
Project: Maven 2.x Release Plugin
Issue Type: Bug
Components: prepare
Affects Versions: 2.0
Reporter: Pedro Rodriguez
We define the repositories in a profile.
The dependency management resolution fails to resolve a pom import if the
import occurs
in an imported pom not found in the reactor.
The following code fragment shows the problem:
While merging managed dependencies of a dependency resolved from the
repository,
the ProjectBuilderConfiguration that is used do not contain the
ProfileManager.
Class: org.apache.maven.project.DefaultMavenProjectBuilder
mergeManagedDependencies(...)
...
if ( dep.getType().equals( "pom" )
&& Artifact.SCOPE_IMPORT.equals( dep.getScope() ) )
{
Artifact artifact =
artifactFactory.createProjectArtifact( dep.getGroupId(), dep.getArtifactId(),
dep.getVersion(), dep.getScope() );
MavenProject project = buildFromRepository(artifact,
parentSearchRepositories, localRepository, false);
DependencyManagement depMgmt =
project.getDependencyManagement();
...
buildFromRepository(...)
...
Model model = findModelFromRepository( artifact,
remoteArtifactRepositories, localRepository, allowStubModel );
ProjectBuilderConfiguration config = new
DefaultProjectBuilderConfiguration().setLocalRepository( localRepository );
return buildInternal( "Artifact [" + artifact + "]", model, config,
remoteArtifactRepositories,
null, false );
buildInternal( ... )
...
ProfileManager externalProfileManager =
config.getGlobalProfileManager();
...
Set aggregatedRemoteWagonRepositories = new LinkedHashSet();
List activeExternalProfiles;
if ( externalProfileManager != null )
{
activeExternalProfiles =
externalProfileManager.getActiveProfiles();
}
else
{
activeExternalProfiles = Collections.EMPTY_LIST;
}
for ( Iterator i = activeExternalProfiles.iterator(); i.hasNext(); )
{
Profile externalProfile = (Profile) i.next();
for ( Iterator repoIterator =
externalProfile.getRepositories().iterator(); repoIterator.hasNext(); )
{
Repository mavenRepo = (Repository) repoIterator.next();
ArtifactRepository artifactRepo = artifactRepo =
ProjectUtils.buildArtifactRepository( mavenRepo,
artifactRepositoryFactory, container );
aggregatedRemoteWagonRepositories.add( artifactRepo );
}
}
Because the GlobalProfileManager was not specified in the
DefaultProjectBuilderConfiguration,
the activeExternalProfiles list is empty and all "remote repositories" are
ignored.
In general, the ProjectBuilderConfiguration is created with a factory method
which correctly set the GlobalProfileManager.
org.apache.maven.execution.DefaultMavenExecutionRequest
public ProjectBuilderConfiguration getProjectBuilderConfiguration()
{
ProjectBuilderConfiguration config = new
DefaultProjectBuilderConfiguration();
config.setLocalRepository( getLocalRepository() )
.setGlobalProfileManager( getGlobalProfileManager() )
.setExecutionProperties( getExecutionProperties() )
.setUserProperties( getUserProperties() )
.setBuildStartTime( startTime );
return config;
}
--
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