Maven
  1. Maven
  2. MNG-3268

Command line doesn't handle multiple -P correctly

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.7
    • Fix Version/s: 2.0.10, 2.1.0-M1
    • Component/s: Command Line
    • Labels:
      None

      Description

      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 ***....

        Issue Links

          Activity

          Henri Tremblay created issue -
          Hide
          Olivier Lamy (*$^¨%`£) added a comment -

          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
          ...

          Show
          Olivier Lamy (*$^¨%`£) added a comment - 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 ...
          Hide
          Henri Tremblay added a comment -

          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.

          Show
          Henri Tremblay added a comment - 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 made changes -
          Field Original Value New Value
          Link This issue relates to MRELEASE-288 [ MRELEASE-288 ]
          Hide
          Paul Gier added a comment -

          Attaching a small patch to allow -P to be specified multiple times.

          Show
          Paul Gier added a comment - Attaching a small patch to allow -P to be specified multiple times.
          Paul Gier made changes -
          Attachment MNG-3268-maven-core.patch [ 34156 ]
          Hide
          Henri Tremblay added a comment -

          Nice! Thanks Paul

          Show
          Henri Tremblay added a comment - Nice! Thanks Paul
          Paul Gier made changes -
          Assignee Paul Gier [ pgier ]
          Paul Gier made changes -
          Fix Version/s 2.0.10 [ 14112 ]
          Fix Version/s 2.1-alpha-1 [ 13143 ]
          Hide
          Paul Gier added a comment -

          This is now fixed in svn.

          Show
          Paul Gier added a comment - This is now fixed in svn.
          Paul Gier made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Hide
          Paul Benedict added a comment -

          It appears this patch also fixes MNG-3545

          Show
          Paul Benedict added a comment - It appears this patch also fixes MNG-3545
          Paul Benedict made changes -
          Link This issue depends upon MNG-3545 [ MNG-3545 ]
          Hide
          John Casey added a comment -

          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.

          Show
          John Casey added a comment - 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.
          John Casey made changes -
          Fix Version/s 2.1.0-M1 [ 14503 ]
          Fix Version/s 3.0-alpha-1 [ 13143 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 08:49:45 UTC 2015 [ 1428223785911 ]
          Mark Thomas made changes -
          Link This issue relates to MRELEASE-288 [ MRELEASE-288 ]
          Mark Thomas made changes -
          Workflow jira [ 12713721 ] Default workflow, editable Closed status [ 12755598 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 21:45:26 UTC 2015 [ 1428270326204 ]
          Mark Thomas made changes -
          Link This issue relates to MRELEASE-288 [ MRELEASE-288 ]
          Mark Thomas made changes -
          Workflow jira [ 12952971 ] Default workflow, editable Closed status [ 12990301 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          183d 3h 25m 1 Paul Gier 02/May/08 16:08

            People

            • Assignee:
              Paul Gier
              Reporter:
              Henri Tremblay
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development