From 1245ac784e777f2d665899fb0dac179fe96ae2f8 Mon Sep 17 00:00:00 2001 From: Paul Gier Date: Fri, 2 May 2008 21:04:22 +0000 Subject: [PATCH] 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 --- .../org/apache/maven/cli/CLIRequestUtils.java | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java index 5cd9c64783..262f31c645 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java @@ -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 ); + } + } } } }