mirror of https://github.com/apache/maven.git
[MNG-2681] Add cli flag to set all snapshot repos to updatePolicy = never
Submitted by: Jason Dillon git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@483809 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0774cc829e
commit
7f65892418
|
@ -54,6 +54,8 @@ public class CLIManager
|
|||
|
||||
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';
|
||||
|
@ -113,6 +115,10 @@ public class CLIManager
|
|||
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 ) );
|
||||
|
||||
|
|
|
@ -169,6 +169,11 @@ public class MavenCli
|
|||
pluginUpdateOverride = Boolean.FALSE;
|
||||
}
|
||||
|
||||
boolean noSnapshotUpdates = false;
|
||||
if (commandLine.hasOption(CLIManager.SUPRESS_SNAPSHOT_UPDATES)) {
|
||||
noSnapshotUpdates = true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -389,6 +394,7 @@ public class MavenCli
|
|||
.setTransferListener( transferListener )
|
||||
.setOffline( offline )
|
||||
.setUpdateSnapshots( updateSnapshots )
|
||||
.setNoSnapshotUpdates( noSnapshotUpdates )
|
||||
.setGlobalChecksumPolicy( globalChecksumPolicy );
|
||||
|
||||
mavenEmbedder.execute( request );
|
||||
|
|
|
@ -129,9 +129,16 @@ public class DefaultMaven
|
|||
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() );
|
||||
|
|
|
@ -96,6 +96,8 @@ public class DefaultMavenExecutionRequest
|
|||
|
||||
private boolean recursive;
|
||||
|
||||
private boolean noSnapshotUpdates;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -198,6 +200,11 @@ public class DefaultMavenExecutionRequest
|
|||
return updateSnapshots;
|
||||
}
|
||||
|
||||
public boolean isNoSnapshotUpdates()
|
||||
{
|
||||
return noSnapshotUpdates;
|
||||
}
|
||||
|
||||
public String getGlobalChecksumPolicy()
|
||||
{
|
||||
return globalChecksumPolicy;
|
||||
|
@ -376,6 +383,13 @@ public class DefaultMavenExecutionRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public MavenExecutionRequest setNoSnapshotUpdates( boolean noSnapshotUpdates )
|
||||
{
|
||||
this.noSnapshotUpdates = noSnapshotUpdates;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public MavenExecutionRequest setGlobalChecksumPolicy( String globalChecksumPolicy )
|
||||
{
|
||||
this.globalChecksumPolicy = globalChecksumPolicy;
|
||||
|
|
|
@ -143,9 +143,13 @@ public interface MavenExecutionRequest
|
|||
|
||||
boolean isUpdateSnapshots();
|
||||
|
||||
MavenExecutionRequest setNoSnapshotUpdates( boolean noSnapshotUpdates );
|
||||
|
||||
// Checksum policy
|
||||
MavenExecutionRequest setGlobalChecksumPolicy( String globalChecksumPolicy );
|
||||
|
||||
boolean isNoSnapshotUpdates();
|
||||
|
||||
String getGlobalChecksumPolicy();
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue