maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r483809 - in /maven/components/trunk: maven-cli/src/main/java/org/apache/maven/cli/ maven-core/src/main/java/org/apache/maven/ maven-core/src/main/java/org/apache/maven/execution/
Date Fri, 08 Dec 2006 03:35:45 GMT
Author: brett
Date: Thu Dec  7 19:35:45 2006
New Revision: 483809

URL: http://svn.apache.org/viewvc?view=rev&rev=483809
Log:
[MNG-2681] Add cli flag to set all snapshot repos to updatePolicy = never
Submitted by: Jason Dillon

Modified:
    maven/components/trunk/maven-cli/src/main/java/org/apache/maven/cli/CLIManager.java
    maven/components/trunk/maven-cli/src/main/java/org/apache/maven/cli/MavenCli.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java

Modified: maven/components/trunk/maven-cli/src/main/java/org/apache/maven/cli/CLIManager.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-cli/src/main/java/org/apache/maven/cli/CLIManager.java?view=diff&rev=483809&r1=483808&r2=483809
==============================================================================
--- maven/components/trunk/maven-cli/src/main/java/org/apache/maven/cli/CLIManager.java (original)
+++ maven/components/trunk/maven-cli/src/main/java/org/apache/maven/cli/CLIManager.java Thu
Dec  7 19:35:45 2006
@@ -54,6 +54,8 @@
 
     public static final String SUPPRESS_PLUGIN_REGISTRY = "npr";
 
+    public static final String SUPRESS_SNAPSHOT_UPDATES = "nsu";
+
     public static final char CHECKSUM_FAILURE_POLICY = 'C';
 
     public static final char CHECKSUM_WARNING_POLICY = 'c';
@@ -112,6 +114,10 @@
             "Synonym for " + FORCE_PLUGIN_UPDATES ).create( FORCE_PLUGIN_UPDATES2 ) );
         options.addOption( OptionBuilder.withLongOpt( "no-plugin-updates" ).withDescription(
             "Suppress upToDate check for any relevant registered plugins" ).create( SUPPRESS_PLUGIN_UPDATES
) );
+
+        options.addOption(OptionBuilder.withLongOpt("no-snapshot-updates")
+                .withDescription("Supress SNAPSHOT updates")
+                .create(SUPRESS_SNAPSHOT_UPDATES));
 
         options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription(
             "Don't use ~/.m2/plugin-registry.xml for plugin versions" ).create( SUPPRESS_PLUGIN_REGISTRY
) );

Modified: maven/components/trunk/maven-cli/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-cli/src/main/java/org/apache/maven/cli/MavenCli.java?view=diff&rev=483809&r1=483808&r2=483809
==============================================================================
--- maven/components/trunk/maven-cli/src/main/java/org/apache/maven/cli/MavenCli.java (original)
+++ maven/components/trunk/maven-cli/src/main/java/org/apache/maven/cli/MavenCli.java Thu
Dec  7 19:35:45 2006
@@ -169,6 +169,11 @@
             pluginUpdateOverride = Boolean.FALSE;
         }
 
+        boolean noSnapshotUpdates = false;
+        if (commandLine.hasOption(CLIManager.SUPRESS_SNAPSHOT_UPDATES)) {
+            noSnapshotUpdates = true;
+        }
+
         // ----------------------------------------------------------------------
         //
         // ----------------------------------------------------------------------
@@ -389,6 +394,7 @@
                 .setTransferListener( transferListener )
                 .setOffline( offline )
                 .setUpdateSnapshots( updateSnapshots )
+                .setNoSnapshotUpdates( noSnapshotUpdates )
                 .setGlobalChecksumPolicy( globalChecksumPolicy );
 
             mavenEmbedder.execute( request );

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?view=diff&rev=483809&r1=483808&r2=483809
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Thu
Dec  7 19:35:45 2006
@@ -129,9 +129,16 @@
             snapshotPolicySet = true;
         }
 
-        if ( !snapshotPolicySet && request.isUpdateSnapshots() )
-        {
-            artifactRepositoryFactory.setGlobalUpdatePolicy( ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS
);
+        if ( !snapshotPolicySet ) {
+            if ( request.isUpdateSnapshots() )
+            {
+                artifactRepositoryFactory.setGlobalUpdatePolicy( ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS
);
+            }
+            else if ( request.isNoSnapshotUpdates() )
+            {
+                getLogger().info( "+ Supressing SNAPSHOT updates.");
+                artifactRepositoryFactory.setGlobalUpdatePolicy( ArtifactRepositoryPolicy.UPDATE_POLICY_NEVER
);
+            }
         }
 
         artifactRepositoryFactory.setGlobalChecksumPolicy( request.getGlobalChecksumPolicy()
);

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java?view=diff&rev=483809&r1=483808&r2=483809
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
Thu Dec  7 19:35:45 2006
@@ -96,6 +96,8 @@
 
     private boolean recursive;
 
+    private boolean noSnapshotUpdates;
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -198,6 +200,11 @@
         return updateSnapshots;
     }
 
+    public boolean isNoSnapshotUpdates()
+    {
+        return noSnapshotUpdates;
+    }
+
     public String getGlobalChecksumPolicy()
     {
         return globalChecksumPolicy;
@@ -372,6 +379,13 @@
     public MavenExecutionRequest setUpdateSnapshots( boolean updateSnapshots )
     {
         this.updateSnapshots = updateSnapshots;
+
+        return this;
+    }
+
+    public MavenExecutionRequest setNoSnapshotUpdates( boolean noSnapshotUpdates )
+    {
+        this.noSnapshotUpdates = noSnapshotUpdates;
 
         return this;
     }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java?view=diff&rev=483809&r1=483808&r2=483809
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
Thu Dec  7 19:35:45 2006
@@ -143,8 +143,12 @@
 
     boolean isUpdateSnapshots();
 
+    MavenExecutionRequest setNoSnapshotUpdates( boolean noSnapshotUpdates );
+
     // Checksum policy
     MavenExecutionRequest setGlobalChecksumPolicy( String globalChecksumPolicy );
+
+    boolean isNoSnapshotUpdates();
 
     String getGlobalChecksumPolicy();
 



Mime
View raw message