You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Marian Macik (Jira)" <ji...@apache.org> on 2021/11/22 19:41:00 UTC

[jira] [Created] (ARCHETYPE-622) maven-archetype-plugin integration-test doesn't use Maven settings from the main build

Marian Macik created ARCHETYPE-622:
--------------------------------------

             Summary: maven-archetype-plugin integration-test doesn't use Maven settings from the main build
                 Key: ARCHETYPE-622
                 URL: https://issues.apache.org/jira/browse/ARCHETYPE-622
             Project: Maven Archetype
          Issue Type: Bug
          Components: Plugin
    Affects Versions: 3.2.0
            Reporter: Marian Macik


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:
{code:xml}
<settingsFile>${session.request.userSettingsFile.path}</settingsFile>{code}
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|https://maven.apache.org/plugins/maven-help-plugin/effective-settings-mojo.html] 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|https://github.com/apache/maven-archetype/blob/master/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java#L666-L681].



--
This message was sent by Atlassian Jira
(v8.20.1#820001)