Issue Details (XML | Word | Printable)

Key: MNG-3268
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Paul Gier
Reporter: Henri Tremblay
Votes: 1
Watchers: 0
Operations

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

Command line doesn't handle multiple -P correctly

Created: 01/Nov/07 12:43 PM   Updated: 03/Sep/08 04:59 PM
Component/s: Command Line
Affects Version/s: 2.0.7
Fix Version/s: 2.0.10, 2.1.0-M1

Time Tracking:
Not Specified

File Attachments: 1. Text File MNG-3268-maven-core.patch (3 kB)

Issue Links:
Related
 
dependent
 


 Description  « Hide
It is currently not possible to have more than one -P on the same command line. Only the first specified profile is considered.

So if you do

mvn -Pmain -Ptest

only the main profile will be taken into account.

This may sound enough but it's not when your maven call is wrapped into a batch file. Let's say you have a batch doing the compilation of a given module:

a.bat
-------------------------------------
mvn install -Pmymodule %*
-------------------------------------

and you want to pass a special integration tests profile you would do:

a.bat -Pintegration-tests

But that won't work since you are not allowed to have two -P.

To merge them in DOS shell is quite a pain in the ***....



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Olivier Lamy added a comment - 01/Nov/07 03:32 PM
Do you want to activate more than one profile ?
If yes, look at mvn -h and you can close the issue :
...
P,-activate-profiles Comma-delimited list of profiles to activate
...

Henri Tremblay added a comment - 01/Nov/07 06:53 PM
No. I know I can do -Pmain,test.

What I need is two -P. One is directly in the batch file and one is passed by the user calling the batch file. The ones in the batch are the default for the script and the one added by the user are specific to a given batch call.

For example, I want to deploy on an application server. The deploy.bat contains a -Pdeploy to tell mvn it should deploy during the build. Then the user pass a -Pdev to tell that he wants to deploy on the dev platform.

That is not currently possible. And I don't want him to have to modify his settings.xml all the time.


Paul Gier added a comment - 25/Apr/08 09:24 AM
Attaching a small patch to allow -P to be specified multiple times.

Henri Tremblay added a comment - 26/Apr/08 07:27 AM
Nice! Thanks Paul

Paul Gier added a comment - 02/May/08 04:08 PM
This is now fixed in svn.

Paul Benedict added a comment - 02/May/08 08:11 PM
It appears this patch also fixes MNG-3545

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.