mirror of https://github.com/apache/maven.git
o Fixed detection of default profiles
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@764944 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2bc43b618a
commit
e203f0c5d3
|
@ -36,8 +36,14 @@ import org.apache.maven.project.builder.PomInterpolatorTag;
|
||||||
import org.codehaus.plexus.PlexusContainer;
|
import org.codehaus.plexus.PlexusContainer;
|
||||||
import org.codehaus.plexus.MutablePlexusContainer;
|
import org.codehaus.plexus.MutablePlexusContainer;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
import java.util.Map.Entry;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
public class DefaultProfileManager
|
public class DefaultProfileManager
|
||||||
implements ProfileManager
|
implements ProfileManager
|
||||||
|
@ -51,7 +57,7 @@ public class DefaultProfileManager
|
||||||
private static final ProfileMatcher defaultMatcher = new DefaultMatcher();
|
private static final ProfileMatcher defaultMatcher = new DefaultMatcher();
|
||||||
|
|
||||||
private static final List<ProfileMatcher> matchers =
|
private static final List<ProfileMatcher> matchers =
|
||||||
(List<ProfileMatcher>) Collections.unmodifiableList( Arrays.asList( new PropertyMatcher(), new FileMatcher(), new JdkMatcher() ) );
|
Collections.unmodifiableList( Arrays.asList( new PropertyMatcher(), new FileMatcher(), new JdkMatcher() ) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the properties passed to the profile manager are the props that
|
* the properties passed to the profile manager are the props that
|
||||||
|
@ -109,7 +115,7 @@ public class DefaultProfileManager
|
||||||
{
|
{
|
||||||
String profileId = profile.getId();
|
String profileId = profile.getId();
|
||||||
|
|
||||||
Profile existing = (Profile) profilesById.get( profileId );
|
Profile existing = profilesById.get( profileId );
|
||||||
if ( existing != null )
|
if ( existing != null )
|
||||||
{
|
{
|
||||||
container.getLogger().warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() +
|
container.getLogger().warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() +
|
||||||
|
@ -135,12 +141,10 @@ public class DefaultProfileManager
|
||||||
{
|
{
|
||||||
List<Profile> activeFromPom = new ArrayList<Profile>();
|
List<Profile> activeFromPom = new ArrayList<Profile>();
|
||||||
List<Profile> activeExternal = new ArrayList<Profile>();
|
List<Profile> activeExternal = new ArrayList<Profile>();
|
||||||
for ( Iterator it = profilesById.entrySet().iterator(); it.hasNext(); )
|
for ( Map.Entry<String, Profile> entry : profilesById.entrySet() )
|
||||||
{
|
{
|
||||||
Map.Entry entry = (Entry) it.next();
|
String profileId = entry.getKey();
|
||||||
|
Profile profile = entry.getValue();
|
||||||
String profileId = (String) entry.getKey();
|
|
||||||
Profile profile = (Profile) entry.getValue();
|
|
||||||
|
|
||||||
if ( !profileActivationContext.isExplicitlyInactive( profileId )
|
if ( !profileActivationContext.isExplicitlyInactive( profileId )
|
||||||
&& (profileActivationContext.isExplicitlyActive( profileId ) || isActive( profile, profileActivationContext ) ) )
|
&& (profileActivationContext.isExplicitlyActive( profileId ) || isActive( profile, profileActivationContext ) ) )
|
||||||
|
@ -170,7 +174,7 @@ public class DefaultProfileManager
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Profile profile = (Profile) profilesById.get( profileId );
|
Profile profile = profilesById.get( profileId );
|
||||||
|
|
||||||
if ( profile != null )
|
if ( profile != null )
|
||||||
{
|
{
|
||||||
|
@ -266,10 +270,8 @@ public class DefaultProfileManager
|
||||||
*/
|
*/
|
||||||
public void addProfiles( List<Profile> profiles )
|
public void addProfiles( List<Profile> profiles )
|
||||||
{
|
{
|
||||||
for ( Iterator it = profiles.iterator(); it.hasNext(); )
|
for ( Profile profile : profiles )
|
||||||
{
|
{
|
||||||
Profile profile = (Profile) it.next();
|
|
||||||
|
|
||||||
addProfile( profile );
|
addProfile( profile );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,7 +281,7 @@ public class DefaultProfileManager
|
||||||
List<Profile> defaults = new ArrayList<Profile>();
|
List<Profile> defaults = new ArrayList<Profile>();
|
||||||
for(Profile p : profiles)
|
for(Profile p : profiles)
|
||||||
{
|
{
|
||||||
if( (p.getActivation() != null && p.getActivation().isActiveByDefault()) || p.getActivation() == null )
|
if ( p.getActivation() != null && p.getActivation().isActiveByDefault() )
|
||||||
{
|
{
|
||||||
defaults.add( p );
|
defaults.add( p );
|
||||||
}
|
}
|
||||||
|
@ -310,7 +312,7 @@ public class DefaultProfileManager
|
||||||
|
|
||||||
private void activateAsDefault( String profileId )
|
private void activateAsDefault( String profileId )
|
||||||
{
|
{
|
||||||
List defaultIds = profileActivationContext.getActiveByDefaultProfileIds();
|
List<String> defaultIds = profileActivationContext.getActiveByDefaultProfileIds();
|
||||||
|
|
||||||
if ( !defaultIds.contains( profileId ) )
|
if ( !defaultIds.contains( profileId ) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue