Make sure external profiles are applied to the superPom before it's used as a basis for inheritance in the project builder. Also, adding some debug statements to the lineage-building process.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@601159 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2007-12-05 00:03:55 +00:00
parent 3488401f83
commit 589db485fd
4 changed files with 32 additions and 4 deletions

View File

@ -92,6 +92,11 @@ public class DefaultProfileAdvisor
ProfileManager externalProfileManager ) ProfileManager externalProfileManager )
throws ProjectBuildingException throws ProjectBuildingException
{ {
if ( externalProfileManager == null )
{
return Collections.EMPTY_LIST;
}
logger.debug( "Building profile manager for model: " + model.getId() logger.debug( "Building profile manager for model: " + model.getId()
+ " with external profile manager including profiles: " + " with external profile manager including profiles: "
+ externalProfileManager.getProfilesById() ); + externalProfileManager.getProfilesById() );

View File

@ -603,7 +603,20 @@ public class DefaultMavenProjectBuilder
profileActivationContext = new DefaultProfileActivationContext( System.getProperties(), false ); profileActivationContext = new DefaultProfileActivationContext( System.getProperties(), false );
} }
superProject.setActiveProfiles( profileAdvisor.applyActivatedProfiles( superModel, projectDescriptor, explicitlyActive, explicitlyInactive, validProfilesXmlLocation, profileActivationContext ) ); LinkedHashSet activeInSuperPom = new LinkedHashSet();
List activated = profileAdvisor.applyActivatedExternalProfiles( superModel, projectDescriptor, externalProfileManager );
if ( !activated.isEmpty() )
{
activeInSuperPom.addAll( activated );
}
activated = profileAdvisor.applyActivatedProfiles( superModel, projectDescriptor, explicitlyActive, explicitlyInactive, validProfilesXmlLocation, profileActivationContext );
if ( !activated.isEmpty() )
{
activeInSuperPom.addAll( activated );
}
superProject.setActiveProfiles( activated );
//noinspection CollectionDeclaredAsConcreteClass //noinspection CollectionDeclaredAsConcreteClass
LinkedList lineage = new LinkedList(); LinkedList lineage = new LinkedList();

View File

@ -278,6 +278,8 @@ public class DefaultModelLineageBuilder
boolean useProfilesXml ) boolean useProfilesXml )
throws ProjectBuildingException throws ProjectBuildingException
{ {
getLogger().debug( "Grabbing profile-injected repositories for: " + model.getId() );
List explicitlyActive; List explicitlyActive;
List explicitlyInactive; List explicitlyInactive;
@ -301,12 +303,18 @@ public class DefaultModelLineageBuilder
pomFile, pomFile,
model.getId() ); model.getId() );
profileRepos.addAll( profileAdvisor.getArtifactRepositoriesFromActiveProfiles( model, getLogger().debug( "Got external-profile repositories: " + profileRepos );
LinkedHashSet pomProfileRepos = profileAdvisor.getArtifactRepositoriesFromActiveProfiles( model,
pomFile, pomFile,
explicitlyActive, explicitlyActive,
explicitlyInactive, explicitlyInactive,
useProfilesXml, useProfilesXml,
context ) ); context );
getLogger().debug( "Got pom-profile repositories: " + pomProfileRepos );
profileRepos.addAll( pomProfileRepos );
if ( !profileRepos.isEmpty() ) if ( !profileRepos.isEmpty() )
{ {
@ -350,6 +358,8 @@ public class DefaultModelLineageBuilder
{ {
try try
{ {
getLogger().debug( "Attempting to resolve parent POM: " + modelParent.getId() + " using repositories:\n" + StringUtils.join( remoteRepositories.iterator(), "\n" ) );
parentPomFile = resolveParentFromRepositories( modelParent, parentPomFile = resolveParentFromRepositories( modelParent,
localRepository, localRepository,
remoteRepositories, remoteRepositories,

View File

@ -387,7 +387,7 @@ public class DefaultModelLineageBuilderTest
assertEquals( parent.getId(), ( (Model) modelIterator.next() ).getId() ); assertEquals( parent.getId(), ( (Model) modelIterator.next() ).getId() );
} }
public void testReadPOMWithParentInRepoBroughtInViaSettingsProfile() public void testReadPOMWithParentInRepoBroughtInViaExternalProfile()
throws Exception throws Exception
{ {
// 1. create project-root directory. // 1. create project-root directory.