for ( MavenProject project : projects )
{
descriptionBuffer.append( "Listing Profiles for Project: " ).append( project.getId() ).append( "\n" );
DefaultProfileManager pm =
new DefaultProfileManager( session.getContainer(), session.getExecutionProperties() );
// Obtain Profiles from external profiles.xml
try
{
loadProjectExternalProfiles( pm, project.getBasedir() );
}
catch ( ProfileActivationException e )
{
throw new MojoExecutionException( "Error obtaining external Profiles:" + e.getMessage(), e );
}
// Attempt to obtain settings profiles
loadSettingsProfiles( pm, session.getSettings() );
// Attempt to obtain profiles from pom.xml
loadProjectPomProfiles( pm, project );
// now display
if ( null == pm.getExplicitlyActivatedIds() || pm.getExplicitlyActivatedIds().size() == 0 )
{
if ( getLog().isWarnEnabled() )
{
getLog().warn( "No profiles detected!" );
}
}
else
{
// This feels more like a hack to filter out inactive profiles, there is no 'direct'
// way to query activation status on a Profile instance.
@SuppressWarnings( "unchecked" )
Map<String, Profile> allProfilesByIds = pm.getProfilesById();
// active Profiles will be a subset of *all* profiles
@SuppressWarnings( "unchecked" )
List<Profile> activeProfiles = project.getActiveProfiles();
for ( Profile activeProfile : activeProfiles )