[ 
https://issues.apache.org/jira/browse/MNG-8162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17860595#comment-17860595
 ] 

Lenny Primak edited comment on MNG-8162 at 6/27/24 4:28 PM:
------------------------------------------------------------

Agreed with the following caveats:
 * Must be able to turn off the warning in settings.xml or on the command line 
(-Dmaven.warnings.nonroot=off)
 * There is a legit case for this, using git submodules to create a build 
system for an existing project. Since there is no submodules in parent 
directories (i.e. ../module/one/pom.xml) this warning should not exist for a 
single-module project

 

See [https://github.com/flowlogix/jbake-maven] for an example of a valid use 
case


was (Author: lprimak):
Agreed with the following caveats:
 * Must be able to turn off the warning in settings.xml or on the command line 
(-Dmaven.warnings.nonroot=off)
 * There is a legit case for this, using git submodules to create a build 
system for an existing project. Since there is no submodules in parent 
directories (i.e. ../module/one/pom.xml) this warning should not exist for a 
single-module project

> Maven should warn about modules relative to parent directory
> ------------------------------------------------------------
>
>                 Key: MNG-8162
>                 URL: https://issues.apache.org/jira/browse/MNG-8162
>             Project: Maven
>          Issue Type: Task
>          Components: Core
>            Reporter: Benjamin Marwell
>            Priority: Major
>
> Maven should warn if a pom project references modules which are not direct 
> descendants, e.g.
> {code:html}
> <module>../other</module>
> {code}
> h2. Rationale
> Given this situation:
> * the repository root does not contain the root pom.xml 
> * A subdirectory contains the "root" pom.xml (e.g. ./Build/pom.xml)
> * Maven must be called either via {{mvn -f Build}} or {{cd Build && mvn}}
> Then it is hard to determine the root:
> * Is it in the VCS clone/checkout root?
> * Is it in the first common ancestor? Maybe it is in 
> {{project/dev/impl/Build}} ?
> * Is root=true a valid tag in either of these cases?
> * what if you call maven from even yet  a higher directory?
> * What if both .mvn directores and the root tags are present?
> * What if there are multitple .mvn directories (lets say in repo root, and in 
> ./project/dev/impl and in ./project/dev/impl/Build)?
> In any of those cases and combinations of those, Maven should print a warning
> h2. Suggested warning
> {code}
> [WARN] This maven project has modules relative to the parent directory 
> (<module>../{..}</module>. This is an invalid configuration and will be 
> unsupported in future releases. To fix, move all descendants of a pom project 
> to its directory, making it a direct descendant.
> {code}
> h2. Checks
> Should be included in the new self-check
> h2. Suggested deprecation
> Maven 5 should not work under such circumstances
> h2. Backports
> Might be a candidate for backporting to 3.9.
> h2. Documentation
> The docs should clarify which "root" takes precedence (and why).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to