Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-3884

Command line arguments don't overwrite settings.xml properties when invoking a plugin

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0.9, 2.1.0-M1
    • None
    • Command Line
    • None
    • All environments

    Description

      To explain the issue, let's start with the following example:

      1°) Run a plugin goal with an argument specified in the command line with the "-D" option only

      mvn eclipse:eclipse -Declipse.projectNameTemplate=CommandLineProjectName

      We can see if we open the generated .project file that the name of the project is as we expect: "CommandLineProjectName"
      This is normal, the goal input parameter is set with the command line property.

      2°) Run a plugin goal with an argument specified in the "settings.xml" file only

      mvn eclipse:eclipse

      with settings.xml containing the following enabled profile:

      <profiles>
      <profile>
      <id>testProfile</id>
      <properties>
      <eclipse.projectNameTemplate>SettingsProjectName</eclipse.projectNameTemplate>
      </properties>
      </profile>
      </profiles>

      <activeProfiles>
      <activeProfile>testProfile</activeProfile>
      </activeProfiles>

      We can see if we open the generated .project file that the name of the project is as we expect: "SettingsProjectName".
      This is normal, the input parameter of the goal is set with the "settings.xml" file property.

      3°) Run a plugin goal with an argument specified in the command line with the "-D" option and with another value in the "settngs.xml" file

      If we use both scenarios, the property value set in the "settings.xml" file will overwrite the value set via the command line with the "-D" option.
      Maven should not react in that way but in the opposite: the command line value should overwite the "settings.xml" file value.

      It is already the case if we reuse the value somewhere in the pom.xml file. It should be the same when invoking a plugin goal.

      Attachments

        Issue Links

          Activity

            People

              bentmann Benjamin Bentmann
              lgo Lieven Govaerts
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: