Issue Details (XML | Word | Printable)

Key: MNG-3368
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: John Casey
Reporter: Paul Benedict
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Maven 2 & 3

Printing version (-v argument) should not stop lifecycle execution

Created: 18/Jan/08 10:52 AM   Updated: 27/Oct/09 09:20 AM   Resolved: 26/Jun/08 11:44 AM
Component/s: Bootstrap & Build, Command Line
Affects Version/s: 2.0.8
Fix Version/s: 2.1.0-M1

Time Tracking:
Not Specified

Issue Links:
Related


 Description  « Hide

I wanted to always print the Maven version when I build, but unfortunately Maven immediately quits after outputting the version. This option should not quit when a lifecycle is also specified. Example: mvn -v install



Paul Benedict added a comment - 01/Feb/08 10:43 AM

I believe the fix is easy. Two use cases have to be supported:
1) If --version and no phase specified, then print version and quit. This prevents the "You must specify at least one goal" message.
2) If --version and phase(s) specified, then print version and continue.

The change needs to be made in org.apache.maven.cli.MavenCli

Line 142 has this:
if ( commandLine.hasOption( CLIManager.VERSION ) )
{
showVersion();
if ( // *** Add second condition ) { return 0; }
}


Barend Garvelink added a comment - 12/Mar/08 10:38 AM - edited

The Java VM itself provides the following options:

-version -----> print product version and exit

-version:<value> -----> require the specified version to run

-showversion -----> print product version and continue

Consider providing the same options in Maven.

(comment edited: apparently Confluence table syntax isn't supported)


Paul Benedict added a comment - 25/Jun/08 06:52 PM

I would be satisfied with -showversion, if Maven developers must keep the current semantics of -version


John Casey added a comment - 26/Jun/08 11:44 AM

New options:

mvn -V clean
mvn --show-version clean

will show the maven, java, etc. versions without stopping the build.

The original -v option will remain intact and unmodified to keep from causing problems with scripted maven executions, etc.


John Casey added a comment - 03/Sep/08 04:59 PM

Adding fix-for for both 2.0.10 and 2.1.0-M1, since 2.1.0-M1 will actually be released first and may not incorporate all of the eventual issue fixes released in 2.0.10.


Benjamin Bentmann added a comment - 17/Feb/09 03:52 AM

Was reverted from 2.0.x branch in r688884.