[ 
https://issues.apache.org/jira/browse/MRELEASE-602?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Osipov closed MRELEASE-602.
-----------------------------------
    Resolution: Auto Closed

This issue has been auto closed because it has been inactive for a long period 
of time. If you think this issue still applies, retest your problem with the 
most recent version of Maven and the affected component, reopen and post your 
results.

> Repositories defined in a profile are ignored while processing dependency 
> management pom imports in a pom resolved from the repository
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MRELEASE-602
>                 URL: https://issues.apache.org/jira/browse/MRELEASE-602
>             Project: Maven 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}}.  
>    
> {code:title=org.apache.maven.project.DefaultMavenProjectBuilder.java}
> 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 );
>             }
>         }
> {code}
> 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}}. 
> {code:title=org.apache.maven.execution.DefaultMavenExecutionRequest.java}
>     public ProjectBuilderConfiguration getProjectBuilderConfiguration()
>     {
>         ProjectBuilderConfiguration config = new 
> DefaultProjectBuilderConfiguration();
>         config.setLocalRepository( getLocalRepository() )
>               .setGlobalProfileManager( getGlobalProfileManager() )
>               .setExecutionProperties( getExecutionProperties() )
>               .setUserProperties( getUserProperties() )
>               .setBuildStartTime( startTime );
>         return config;
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to