Uploaded image for project: 'Maven Archetype'
  1. Maven Archetype
  2. ARCHETYPE-622

maven-archetype-plugin integration-test doesn't use Maven settings from the main build

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.0
    • 3.2.1
    • Plugin
    • None

    Description

      Hi,

      I would like to raise an issue for the Maven Archetype Plugin integration-test goal. When I execute the plugin with integration-test goal, I would expect that it would continue using maven settings from the main build unless otherwise specified. This is how Maven Invoker Plugin already behaves and because of this, there is inconsistency between the two. Currently the archetype plugin either uses no settings (the inner Maven build is ran as if without -s option) or uses settings.xml file provided via settingsFile config option or archetype.test.settingsFile property.

      The issue here is, if a user wants to always propagate settings from the Maven build (invoker default), it does not always work. There are basically 2 options:
      1. Permanently add settingsFile reference to the POM file like this:

      <settingsFile>${session.request.userSettingsFile.path}</settingsFile>

      Which will use the path from settings.xml provided to the main build. The issue with this approach is that in case a user doesn't provide the -s option, the maven invoker will fail saying that ${user.home}/.m2/settings.xml doesn't exist because by default Maven doesn't create this file with default installation, i.e. it is not mandatory. So there is no way to satisfy both use cases (pass the settings of the main build with and without -s option specified).

      OR

      2. Explicitly set archetype.test.settingsFile from the command line in case a user is going to specify the -s option with the same value. In case a user is not going to provide the -s option, don't set the property from command line. This is again not ideal as we need to remember to specify that one property if and only if -s is specified.

      So far we have done a workaround which will dump the current Maven settings to a file with the help of the effective-settings goal of the maven-help-plugin and then we reference it using the settingsFile config option of the archetype plugin.

      The main issue I see is that this doesn't work as the maven invoker plugin, although the functionality is the same - run integration tests on another project. Invoker plugin by default takes the settings from the main build, unless overridden. On the other hand, archetype plugin takes either nothing (i.e. will use default settings, different from the main build), or an external settings.xml.

      Attachments

        Issue Links

          Activity

            People

              slachiewicz Sylwester Lachiewicz
              mmacik Marian Macik
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: