Add support for multiple -P params on the command line.

Issue id: MNG-3268


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@652912 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Paul Gier 2008-05-02 21:04:22 +00:00
parent 706890fd2b
commit 1245ac784e
1 changed files with 23 additions and 17 deletions

View File

@ -146,26 +146,32 @@ public final class CLIRequestUtils
if ( commandLine.hasOption( CLIManager.ACTIVATE_PROFILES ) )
{
String profilesLine = commandLine.getOptionValue( CLIManager.ACTIVATE_PROFILES );
String [] profileOptionValues = commandLine.getOptionValues( CLIManager.ACTIVATE_PROFILES );
StringTokenizer profileTokens = new StringTokenizer( profilesLine, "," );
while ( profileTokens.hasMoreTokens() )
if ( profileOptionValues != null )
{
String profileAction = profileTokens.nextToken().trim();
for ( int i=0; i < profileOptionValues.length; ++i )
{
StringTokenizer profileTokens = new StringTokenizer( profileOptionValues[i] , "," );
if ( profileAction.startsWith( "-" ) )
{
activeProfiles.add( profileAction.substring( 1 ) );
}
else if ( profileAction.startsWith( "+" ) )
{
inactiveProfiles.add( profileAction.substring( 1 ) );
}
else
{
// TODO: deprecate this eventually!
activeProfiles.add( profileAction );
while ( profileTokens.hasMoreTokens() )
{
String profileAction = profileTokens.nextToken().trim();
if ( profileAction.startsWith( "-" ) )
{
activeProfiles.add( profileAction.substring( 1 ) );
}
else if ( profileAction.startsWith( "+" ) )
{
inactiveProfiles.add( profileAction.substring( 1 ) );
}
else
{
// TODO: deprecate this eventually!
activeProfiles.add( profileAction );
}
}
}
}
}