Author: jdcasey
Date: Tue Jun 21 07:51:55 2005
New Revision: 191664
URL: http://svn.apache.org/viewcvs?rev=191664&view=rev
Log:
Resolving: MNG-495
o Pressing [ENTER] at a plugin update prompt should result in the plugin being
registered, as indicated by the prompt.
o Use CLI switch '--no-plugin-updates' to suppress usage of the plugin registry
o Use CLI switch '--update-plugins' to force updated/resolved plugin versions
to be registered
o Neither of these has a short CLI option, since we're starting to run out of
sensible char options for these types of things.
Modified:
maven/components/trunk/m2-bootstrap-all.bat
maven/components/trunk/m2-bootstrap-all.sh
maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java
Modified: maven/components/trunk/m2-bootstrap-all.bat
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/m2-bootstrap-all.bat?rev=191664&r1=191663&r2=191664&view=diff
==============================================================================
--- maven/components/trunk/m2-bootstrap-all.bat (original)
+++ maven/components/trunk/m2-bootstrap-all.bat Tue Jun 21 07:51:55 2005
@@ -115,7 +115,7 @@
echo Rebuilding maven2 plugins
cd maven-plugins
-call m2 --batch-mode -DupdateReleaseInfo=true -e %MAVEN_CMD_LINE_ARGS%
clean:clean install
+call m2 --no-plugin-updates --batch-mode -DupdateReleaseInfo=true -e
%MAVEN_CMD_LINE_ARGS% clean:clean install
cd ..
echo Running integration tests
Modified: maven/components/trunk/m2-bootstrap-all.sh
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/m2-bootstrap-all.sh?rev=191664&r1=191663&r2=191664&view=diff
==============================================================================
--- maven/components/trunk/m2-bootstrap-all.sh (original)
+++ maven/components/trunk/m2-bootstrap-all.sh Tue Jun 21 07:51:55 2005
@@ -51,7 +51,7 @@
cd maven-plugins
# update the release info to ensure these versions get used in the
integration tests
- m2 --batch-mode -DupdateReleaseInfo=true -e $ARGS clean:clean install
+ m2 --no-plugin-updates --batch-mode -DupdateReleaseInfo=true -e $ARGS
clean:clean install
ret=$?; if [ $ret != 0 ]; then exit $ret; fi
)
ret=$?; if [ $ret != 0 ]; then exit $ret; fi
Modified:
maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java?rev=191664&r1=191663&r2=191664&view=diff
==============================================================================
---
maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java
(original)
+++
maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java
Tue Jun 21 07:51:55 2005
@@ -492,6 +492,8 @@
cli.createArgument().setValue( "-e" );
+ cli.createArgument().setValue( "--no-plugin-updates" );
+
cli.createArgument().setValue( "--batch-mode" );
for ( Iterator i = properties.keySet().iterator(); i.hasNext(); )
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java?rev=191664&r1=191663&r2=191664&view=diff
==============================================================================
---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
(original)
+++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
Tue Jun 21 07:51:55 2005
@@ -197,7 +197,11 @@
if ( commandLine.hasOption( CLIManager.FORCE_PLUGIN_UPDATES ) )
{
- settings.getRuntimeInfo().setPluginUpdateForced( true );
+ settings.getRuntimeInfo().setPluginUpdateOverride( Boolean.TRUE );
+ }
+ else if ( commandLine.hasOption( CLIManager.SUPPRESS_PLUGIN_UPDATES ) )
+ {
+ settings.getRuntimeInfo().setPluginUpdateOverride( Boolean.FALSE );
}
List projectFiles = null;
@@ -522,7 +526,9 @@
public static final char ACTIVATE_PROFILES = 'P';
- public static final char FORCE_PLUGIN_UPDATES = 'F';
+ public static final String FORCE_PLUGIN_UPDATES = "update-plugins";
+
+ public static final String SUPPRESS_PLUGIN_UPDATES =
"no-plugin-updates";
public static final char CHECKSUM_FAILURE_POLICY = 'C';
@@ -554,7 +560,8 @@
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( "update-plugins"
).withDescription( "Force upToDate check for any relevant registered plugins"
).create( FORCE_PLUGIN_UPDATES ) );
+ options.addOption( OptionBuilder.withLongOpt( FORCE_PLUGIN_UPDATES
).withDescription( "Force upToDate check for any relevant registered plugins"
).create() );
+ options.addOption( OptionBuilder.withLongOpt(
SUPPRESS_PLUGIN_UPDATES ).withDescription( "Suppress upToDate check for any
relevant registered plugins" ).create() );
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 ) );
}
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java?rev=191664&r1=191663&r2=191664&view=diff
==============================================================================
---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
(original)
+++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
Tue Jun 21 07:51:55 2005
@@ -76,18 +76,25 @@
// we're not going to prompt the user to accept a plugin update until
we find one.
boolean promptToPersist = false;
+ // determine the behavior WRT prompting the user and installing plugin
updates.
+ Boolean pluginUpdateOverride =
settings.getRuntimeInfo().getPluginUpdateOverride();
+
// second pass...if the plugin is listed in the settings.xml, use the
version from <useVersion/>.
if ( StringUtils.isEmpty( version ) )
{
- // 1. resolve existing useVersion.
+ // resolve existing useVersion.
version = resolveExistingFromPluginRegistry( groupId, artifactId );
if ( StringUtils.isNotEmpty( version ) )
{
- boolean forceUpdate =
settings.getRuntimeInfo().isPluginUpdateForced();
-
// 2. check for updates. Determine whether this is the right
time to attempt to update the version.
- if ( forceUpdate || shouldCheckForUpdates( groupId, artifactId
) )
+ // Only check for plugin updates if:
+ //
+ // a. the CLI switch to force plugin updates is set, OR BOTH
OF THE FOLLOWING:
+ // b. the CLI switch to suppress plugin updates is NOT set,
AND
+ // c. the update interval for the plugin has triggered an
update check.
+ if ( Boolean.TRUE.equals( pluginUpdateOverride )
+ || ( !Boolean.FALSE.equals( pluginUpdateOverride ) &&
shouldCheckForUpdates( groupId, artifactId ) ) )
{
updatedVersion = resolveReleaseVersion( groupId,
artifactId, project
.getRemoteArtifactRepositories(), localRepository );
@@ -142,7 +149,7 @@
// for a decision on updating the plugin in the registry...rather than
prompting
// the user.
boolean inInteractiveMode = settings.isInteractiveMode();
-
+
// determines what should be done if we're in non-interactive mode.
// if true, then just update the registry with the new versions.
String s = getPluginRegistry( groupId, artifactId ).getAutoUpdate();
@@ -155,36 +162,40 @@
// We should persist by default if:
// 1. we detected a change in the plugin version from what was in the
registry, or
// a. the plugin is not registered
- // 2. we're in interactive mode, or
+ // 2. the pluginUpdateOverride flag has NOT been set to Boolean.FALSE
(suppression mode)
+ // 3. we're in interactive mode, or
// a. the registry is declared to be in autoUpdate mode
//
// NOTE: This is only the default value; it may be changed as the
result of prompting the user.
- boolean persistUpdate = promptToPersist && ( inInteractiveMode ||
autoUpdate );
+ boolean persistUpdate = promptToPersist && !Boolean.FALSE.equals(
pluginUpdateOverride )
+ && ( inInteractiveMode || autoUpdate );
+ // retrieve the apply-to-all flag, if it's been set previously.
Boolean applyToAll =
settings.getRuntimeInfo().getApplyToAllPluginUpdates();
-
- // Incorporate interactive-mode and previous decisions on
apply-to-all, if appropriate.
+
+ // Incorporate interactive-mode CLI overrides, and previous decisions
on apply-to-all, if appropriate.
// don't prompt if not in interactive mode.
+ // don't prompt if the CLI pluginUpdateOverride is set (either
suppression or force mode will stop prompting)
// don't prompt if the user has selected ALL/NONE previously in this
session
//
// NOTE: We're incorporating here, to make the usages of this check
more consistent and
// resistant to change.
- promptToPersist = promptToPersist && applyToAll == null &&
inInteractiveMode;
+ promptToPersist = promptToPersist && pluginUpdateOverride == null &&
applyToAll == null && inInteractiveMode;
if ( promptToPersist )
{
persistUpdate = promptToPersistPluginUpdate( version,
updatedVersion, groupId, artifactId, settings );
}
-
+
// if it is determined that we should use this version, persist it as
useVersion.
// cases where this version will be persisted:
// 1. the user is prompted and answers yes or all
- // 2. the user has previously answeres all in this session
+ // 2. the user has previously answered all in this session
// 3. the build is running in non-interactive mode, and the registry
setting is for auto-update
- if ( ( applyToAll == null || applyToAll.booleanValue() ) &&
persistUpdate )
+ if ( !Boolean.FALSE.equals( applyToAll ) && persistUpdate )
{
updatePluginVersionInRegistry( groupId, artifactId, updatedVersion
);
-
+
// we're using the updated version of the plugin in this session
as well.
version = updatedVersion;
}
@@ -293,7 +304,7 @@
if ( !StringUtils.isEmpty( persistAnswer ) )
{
persistAnswer = persistAnswer.toLowerCase();
-
+
if ( persistAnswer.startsWith( "y" ) )
{
shouldPersist = true;
@@ -308,8 +319,17 @@
{
settings.getRuntimeInfo().setApplyToAllPluginUpdates(
Boolean.FALSE );
}
+ else if ( persistAnswer.startsWith( "n" ) )
+ {
+ shouldPersist = false;
+ }
+ else
+ {
+ // default to yes.
+ shouldPersist = true;
+ }
}
-
+
if ( shouldPersist )
{
getLogger().info( "Updating plugin version to " +
updatedVersion );
@@ -318,7 +338,7 @@
{
getLogger().info( "NOT updating plugin version to " +
updatedVersion );
}
-
+
return shouldPersist;
}
@@ -450,10 +470,11 @@
else
{
plugin.setUseVersion( version );
-
- SimpleDateFormat format = new SimpleDateFormat(
org.apache.maven.plugin.registry.Plugin.LAST_CHECKED_DATE_FORMAT );
-
- plugin.setLastChecked(format.format( new Date() ) );
+
+ SimpleDateFormat format = new SimpleDateFormat(
+
org.apache.maven.plugin.registry.Plugin.LAST_CHECKED_DATE_FORMAT );
+
+ plugin.setLastChecked( format.format( new Date() ) );
}
}
else
Modified:
maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java?rev=191664&r1=191663&r2=191664&view=diff
==============================================================================
---
maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java
(original)
+++
maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java
Tue Jun 21 07:51:55 2005
@@ -24,7 +24,8 @@
{
private File file;
- private boolean pluginUpdateForced = false;
+
+ private Boolean pluginUpdateForced;
// using Boolean for 3VL (null, true-to-all, false-to-all)
private Boolean applyToAllPluginUpdates;
@@ -50,12 +51,12 @@
return file;
}
- public void setPluginUpdateForced( boolean pluginUpdateForced )
+ public void setPluginUpdateOverride( Boolean pluginUpdateForced )
{
this.pluginUpdateForced = pluginUpdateForced;
}
- public boolean isPluginUpdateForced()
+ public Boolean getPluginUpdateOverride()
{
return pluginUpdateForced;
}
@@ -98,5 +99,5 @@
{
return localRepositorySourceLevel;
}
-
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]