Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2
-
Fix Version/s: None
-
Labels:None
-
Patch Submitted:Yes
-
Number of attachments :
Description
As discussed last week in the IRC channel, I have implemented this functionality and would like to propose a patch for review and ask for it to be included in the next release (probably 1.4, since I see 1.3 is almost done, with the exception of the integration tests...?).
I have gone through the code and done the following:
- I have added interactive mode. This is triggered by the -Dinteractive property and is currently only used during versions:update-parent, versions:use-latest-snapshots and versions:update-properties.
- I have refactored some of the code and extracted a couple of methods (for example findLatestSnapshotVersion) from UseLatestSnapshotsMojo to AbstractVersionsUpdaterMojo in order to be able to re-use it from UpdateParentMojo as well.
- I have fixed a problem which was not initially obvious, unless you were to use interactive mode, where it manifested itself. It consisted in the fact that the plugin tries to replace the versions of the dependencies without caring whether they are declared directly in the current pom, or whether they are inherited. While this does not appear to be a grave problem at first glance, this takes more time this way and otherwise makes the interactive mode prompt you for versions of dependencies which you don't really need to set, as they're already inherited. I have fixed this by comparing with the project's original model.
- I have added a property (allowUpdatesOfExistingSnapshots) which allows you to update the versions of dependencies which are already set to SNAPSHOT-s. This is useful for cases where at some time in the past on a rarely touched module you've set a SNAPSHOT version (for example 1.2-SNAPSHOT) for a dependency which now has much newer versions (1.9-SNAPSHOT).
Unfortunately, at the moment I am not sure if and how I can provide integration tests. I am, however, quite certain that a lot of people would also benefit from these changes.
Therefore, I would like to contribute my changes to the plugin.
Let me know how you find the proposed patch and if I should do anything else.
Issue Links
- duplicates
-
MVERSIONS-126
Add update-interactive goal
-
$ svn info
Path: .
URL: https://svn.codehaus.org/mojo/trunk/mojo/versions-maven-plugin
Repository Root: https://svn.codehaus.org/mojo
Repository UUID: 52ab4f32-60fc-0310-b215-8acea882cd1b
Revision: 15549
Node Kind: directory
Schedule: normal
Last Changed Author: stephenconnolly
Last Changed Rev: 15549
Last Changed Date: 2011-12-12 10:04:52 +0000 (Mon, 12 Dec 2011)
patch -p0 -i ~/Downloads/MVERSIONS-157.diff
patching file src/main/java/org/codehaus/mojo/versions/UseLatestSnapshotsMojo.java
patching file src/main/java/org/codehaus/mojo/versions/AbstractVersionsDependencyUpdaterMojo.java
patching file src/main/java/org/codehaus/mojo/versions/AbstractVersionsUpdaterMojo.java
Hunk #1 succeeded at 28 with fuzz 2 (offset 1 line).
Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).
Hunk #3 succeeded at 209 with fuzz 2 (offset 7 lines).
Hunk #4 succeeded at 330 (offset 7 lines).
Hunk #5 succeeded at 688 with fuzz 2 (offset 26 lines).
patching file src/main/java/org/codehaus/mojo/versions/UpdateParentMojo.java
patching file src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java
Hunk #1 FAILED at 19.
Hunk #2 FAILED at 113.
2 out of 2 hunks FAILED – saving rejects to file src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java.rej