From c94f27a8b46426e9a6870879280fc16afa927222 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Thu, 3 Jun 2010 19:53:09 +0000 Subject: [PATCH] [MNG-4697] Deprecate ununsed CLI options for plugin registry git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@951135 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultMavenExecutionRequest.java | 15 ------------ .../execution/MavenExecutionRequest.java | 3 --- .../java/org/apache/maven/cli/CLIManager.java | 12 +++------- .../java/org/apache/maven/cli/MavenCli.java | 23 +++++++++---------- 4 files changed, 14 insertions(+), 39 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java index e8a568f549..fd6f15fc04 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java @@ -62,8 +62,6 @@ public class DefaultMavenExecutionRequest private List pluginGroups; - private boolean usePluginUpdateOverride; - private boolean isProjectPresent = true; // ---------------------------------------------------------------------------- @@ -153,7 +151,6 @@ public class DefaultMavenExecutionRequest copy.setMirrors( original.getMirrors() ); copy.setProfiles( original.getProfiles() ); copy.setPluginGroups( original.getPluginGroups() ); - copy.setUsePluginUpdateOverride( original.isUsePluginUpdateOverride() ); copy.setProjectPresent( original.isProjectPresent() ); copy.setUserSettingsFile( original.getUserSettingsFile() ); copy.setGlobalSettingsFile( original.getGlobalSettingsFile() ); @@ -836,18 +833,6 @@ public class DefaultMavenExecutionRequest return this; } - public boolean isUsePluginUpdateOverride() - { - return usePluginUpdateOverride; - } - - public MavenExecutionRequest setUsePluginUpdateOverride( boolean usePluginUpdateOverride ) - { - this.usePluginUpdateOverride = usePluginUpdateOverride; - - return this; - } - public MavenExecutionRequest setRecursive( boolean recursive ) { this.recursive = recursive; diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index 5a87089be0..27bc40c58f 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -237,9 +237,6 @@ public interface MavenExecutionRequest MavenExecutionRequest addPluginGroup( String pluginGroup ); MavenExecutionRequest addPluginGroups( List pluginGroups ); - boolean isUsePluginUpdateOverride(); - MavenExecutionRequest setUsePluginUpdateOverride( boolean usePluginUpdateOverride ); - boolean isProjectPresent(); MavenExecutionRequest setProjectPresent( boolean isProjectPresent ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java index 61971b5066..53e50cedbb 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java @@ -60,12 +60,6 @@ public class CLIManager public static final char ACTIVATE_PROFILES = 'P'; - public static final String FORCE_PLUGIN_UPDATES = "cpu"; - - public static final String FORCE_PLUGIN_UPDATES2 = "up"; - - public static final String SUPPRESS_PLUGIN_UPDATES = "npu"; - public static final String SUPRESS_SNAPSHOT_UPDATES = "nsu"; public static final char CHECKSUM_FAILURE_POLICY = 'C'; @@ -118,9 +112,6 @@ public class CLIManager options.addOption( OptionBuilder.withLongOpt( "update-snapshots" ).withDescription( "Forces a check for updated releases and snapshots on remote repositories" ).create( UPDATE_SNAPSHOTS ) ); options.addOption( OptionBuilder.withLongOpt( "activate-profiles" ).withDescription( "Comma-delimited list of profiles to activate" ).hasArg().create( ACTIVATE_PROFILES ) ); options.addOption( OptionBuilder.withLongOpt( "batch-mode" ).withDescription( "Run in non-interactive (batch) mode" ).create( BATCH_MODE ) ); - options.addOption( OptionBuilder.withLongOpt( "check-plugin-updates" ).withDescription( "Force upToDate check for any relevant registered plugins" ).create( FORCE_PLUGIN_UPDATES ) ); - options.addOption( OptionBuilder.withLongOpt( "update-plugins" ).withDescription( "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( "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 ) ); @@ -143,6 +134,9 @@ public class CLIManager // Adding this back in for compatibility with the verifier that hard codes this option. options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) ); + options.addOption( OptionBuilder.withLongOpt( "check-plugin-updates" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "cpu" ) ); + options.addOption( OptionBuilder.withLongOpt( "update-plugins" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "up" ) ); + options.addOption( OptionBuilder.withLongOpt( "no-plugin-updates" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npu" ) ); } public CommandLine parse( String[] args ) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 6c4ba5850c..9d4f79c840 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -630,6 +630,16 @@ public class MavenCli boolean debug = cliRequest.debug; boolean quiet = cliRequest.quiet; boolean showErrors = cliRequest.showErrors; + + String[] deprecatedOptions = { "up", "npu", "cpu", "npr" }; + for ( String deprecatedOption : deprecatedOptions ) + { + if ( commandLine.hasOption( deprecatedOption ) ) + { + cliRequest.stdout.println( "[WARNING] Command line option -" + deprecatedOption + + " is deprecated and will be removed in future Maven versions." ); + } + } // ---------------------------------------------------------------------- // Now that we have everything that we need we will fire up plexus and @@ -641,17 +651,6 @@ public class MavenCli request.setInteractiveMode( false ); } - boolean pluginUpdateOverride = false; - - if ( commandLine.hasOption( CLIManager.FORCE_PLUGIN_UPDATES ) || commandLine.hasOption( CLIManager.FORCE_PLUGIN_UPDATES2 ) ) - { - pluginUpdateOverride = true; - } - else if ( commandLine.hasOption( CLIManager.SUPPRESS_PLUGIN_UPDATES ) ) - { - pluginUpdateOverride = false; - } - boolean noSnapshotUpdates = false; if ( commandLine.hasOption( CLIManager.SUPRESS_SNAPSHOT_UPDATES ) ) { @@ -809,7 +808,7 @@ public class MavenCli .setReactorFailureBehavior( reactorFailureBehaviour ) // default: fail fast .setRecursive( recursive ) // default: true .setShowErrors( showErrors ) // default: false - .setUsePluginUpdateOverride( pluginUpdateOverride ).addActiveProfiles( activeProfiles ) // optional + .addActiveProfiles( activeProfiles ) // optional .addInactiveProfiles( inactiveProfiles ) // optional .setLoggingLevel( loggingLevel ) // default: info .setTransferListener( transferListener ) // default: batch mode which goes along with interactive