maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r726563 - in /maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli: CLIManager.java MavenCli.java
Date Sun, 14 Dec 2008 22:27:23 GMT
Author: bentmann
Date: Sun Dec 14 14:27:23 2008
New Revision: 726563

URL: http://svn.apache.org/viewvc?rev=726563&view=rev
Log:
[MNG-3914] Add CLI option to control location of global settings from command line

Modified:
    maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
    maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java

Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java?rev=726563&r1=726562&r2=726563&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
(original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
Sun Dec 14 14:27:23 2008
@@ -74,6 +74,8 @@
 
     public static final char ALTERNATE_USER_SETTINGS = 's';
 
+    public static final String ALTERNATE_GLOBAL_SETTINGS = "gs";
+
     public static final String FAIL_FAST = "ff";
 
     public static final String FAIL_AT_END = "fae";
@@ -108,6 +110,7 @@
         options.addOption( OptionBuilder.withLongOpt( "strict-checksums" ).withDescription(
"Fail the build if checksums don't match" ).create( CHECKSUM_FAILURE_POLICY ) );
         options.addOption( OptionBuilder.withLongOpt( "lax-checksums" ).withDescription(
"Warn if checksums don't match" ).create( CHECKSUM_WARNING_POLICY ) );
         options.addOption( OptionBuilder.withLongOpt( "settings" ).withDescription( "Alternate
path for the user settings file" ).hasArg().create( ALTERNATE_USER_SETTINGS ) );
+        options.addOption( OptionBuilder.withLongOpt( "global-settings" ).withDescription(
"Alternate path for the global settings file" ).hasArg().create( ALTERNATE_GLOBAL_SETTINGS
) );
         options.addOption( OptionBuilder.withLongOpt( "fail-fast" ).withDescription( "Stop
at first failure in reactorized builds" ).create( FAIL_FAST ) );
         options.addOption( OptionBuilder.withLongOpt( "fail-at-end" ).withDescription( "Only
fail the build afterwards; allow all non-impacted builds to continue" ).create( FAIL_AT_END
) );
         options.addOption( OptionBuilder.withLongOpt( "fail-never" ).withDescription( "NEVER
fail the build, regardless of project result" ).create( FAIL_NEVER ) );

Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java?rev=726563&r1=726562&r2=726563&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
(original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Sun Dec 14 14:27:23 2008
@@ -190,13 +190,24 @@
         }
         else
         {
-            userSettingsFile =  MavenEmbedder.DEFAULT_USER_SETTINGS_FILE;
+            userSettingsFile = MavenEmbedder.DEFAULT_USER_SETTINGS_FILE;
+        }
+
+        File globalSettingsFile;
+
+        if ( commandLine.hasOption( CLIManager.ALTERNATE_GLOBAL_SETTINGS ) )
+        {
+            globalSettingsFile = new File( commandLine.getOptionValue( CLIManager.ALTERNATE_GLOBAL_SETTINGS
) );
+        }
+        else
+        {
+            globalSettingsFile = MavenEmbedder.DEFAULT_GLOBAL_SETTINGS_FILE;
         }
 
         Configuration configuration = new DefaultConfiguration()
             .setErrorReporter( new DefaultCoreErrorReporter() )
             .setUserSettingsFile( userSettingsFile )
-            .setGlobalSettingsFile( MavenEmbedder.DEFAULT_GLOBAL_SETTINGS_FILE )
+            .setGlobalSettingsFile( globalSettingsFile )
             .setClassWorld( classWorld );
 
         if ( commandLine.hasOption( CLIManager.LOG_FILE ) )



Mime
View raw message