[
https://issues.apache.org/jira/browse/MNG-6762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17423213#comment-17423213
]
Anatoly Zaretsky edited comment on MNG-6762 at 10/1/21, 9:53 AM:
-----------------------------------------------------------------
[~michael-o] While adding the resolution of environment variables to
.mvn/maven.config processing might help solve the problem, it still requires
manual intervention: namely changing .mvn/maven.config to explicitly reference
some variable and setting up and maintaining an external infrastructure to
define this variable (shell scripts, CI settings, etc.). Also this
inconsistency between "mvn -f dir ..." and "cd dir; mvn ..." still feels
somewhat unnatural.
What are your thougts on implicitly resolving relative paths in
.mvn/maven.config against ${maven.multiModuleProjectDirectory}? This is a far
less generic and powerful feature than MNG-6303, and is quite easy to implement
in a portable way. Two years ago I experimented with implementing it, but did
not proceed with a pull request due to the lack of personal time and some
uncertainty about whether is was actually useful
([https://github.com/apache/maven/compare/master...azaretsky:cli-maven.config-resolution]).
If you find the idea viable, I could revive it.
was (Author: anatoly.zaretsky):
[~michael-o] While adding the resolution of environment variables to
.mvn/maven.config processing might help solve the problem, it still requires
manual intervention: namely changing .mvn/maven.config to explicitly reference
some variable and setting up and maintaining an external infrastructure to
define this variable (shell scripts, CI settings, etc.). Also this
inconsistency between "mvn -f dir ..." and "cd dir; mvn ..." still feels
somewhat unnatural.
What are your thougts on implicitly resolving relative paths in
.mvn/maven.config against ${maven.multiModuleProjectDirectory}? This is a far
less generic and powerful feature than MNG-6303, and is quite easy to implement
in a portable way. Two years ago I experimented with implementing it, but did
not proceed with a pull request due to the lack personal time and some
uncertainty about whether is was actually useful
([https://github.com/apache/maven/compare/master...azaretsky:cli-maven.config-resolution]).
If you find the idea viable, I could revive it.
> Multimodule project with .mvn/settings.xml not working properly
> ---------------------------------------------------------------
>
> Key: MNG-6762
> URL: https://issues.apache.org/jira/browse/MNG-6762
> Project: Maven
> Issue Type: Improvement
> Affects Versions: 3.5.4
> Reporter: Morten Minke
> Priority: Minor
> Time Spent: 20m
> Remaining Estimate: 0h
>
> I have a project with the following setup:
>
> {noformat}
> - MyProject
> |- .mvn
> | |- maven.config
> | |- settings.xml
> |- MyModule1
> | |- pom.xml
> |- MyModule2
> | |- pom.xml
> |- pom.xml{noformat}
>
> The .mvn/maven.config file contains the following:
> {noformat}
> ..
> --settings .mvn/settings.xml{noformat}
> With this setup, I cannot build the modules separately because it cannot find
> the .mvn/settings.xml file in the MyModule1 directory.
>
> I looked into the code and saw that in the mvn script, the .mvn folder is
> searched for in the parent folders. If it is found, that folder is marked as
> the 'maven.multiModuleProjectDirectory'.
>
> However, as soon as the configuration is loaded, this
> multiModuleProjectDirectory is not used anymore for the interpretation of the
> --settings property, therefor maven tries to find the .mvn/settings.xml file
> inside the MyModule1 folder where it is not found.
> This results in an Exception and termination of Maven.
>
> I thought of a couple of ways this could be solved:
> * Allow for a variable substitution to work in the maven.config file and
> thus reference something like:
> {noformat}
> ..
> --settings ${baseDir}/.mvn/settings.xml{noformat}
> * When the maven.multiModuleProjectDirectory is configured and the
> --settings flag is a relative directory, than use the
> maven.multiModuleProjectDirectory as the root to obtain the settings.xml file.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)