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

ASF GitHub Bot commented on MNG-7038:
-------------------------------------

gnodet commented on PR #840:
URL: https://github.com/apache/maven/pull/840#issuecomment-1288104958

   > A practical example is in this project 
https://github.com/nielsbasjes/yauaa I wanted to have a single set of project 
specific checkstyle config. I ended up with packaging these files in a jar and 
making that a dependency of the checkstyle plugin.
   > The only reason is not having a stable topdir which I could refer to.
   
   Well, I don't think the _topdir_ as defined above would work.  What you need 
here, is a _project resource_, so can have a stable absolute path on the file 
system for the root of the project.  It has nothing to do with parent/child 
relationship imho.  The parent/child relationship defines inheritance in the 
project models, but is completely unrelated to their respective file system 
location.  And what we need here is definitely a file system based property.
   
   This top level directory is used by maven.  When you invoke maven from a 
child, all the POMs from the reactor are loaded.  This is done through the 
`multiModuleProjectDirectory`.   And that one is also used to load various 
_build settings_ currently, such as `.mvn/maven.config` and 
`.mvn/extensions.xml`.
   
   I think this property works well when the projects are standalone.
   
   Problems arise when projects are aggregated, or when `.mvn` directory does 
not exist for the current project, but exists in a parent directory.  In which 
case, the computation is kinda broken because it goes outside the project's 
root directory.
   Not sure yet how to fix that for the aggregation case, but for the second 
case, we could refine by checking if there's a `pom.xml` file in the parent 
folder before allowing to use it.
   




> Introduce public property to point to a root directory of (multi-module) 
> project
> --------------------------------------------------------------------------------
>
>                 Key: MNG-7038
>                 URL: https://issues.apache.org/jira/browse/MNG-7038
>             Project: Maven
>          Issue Type: Improvement
>            Reporter: Envious Guest
>            Priority: Major
>             Fix For: Issues to be reviewed for 4.x
>
>
> This is a request to expose a property *maven.multiModuleProjectDirectory* 
> which is currently internal (or introduce a brand new one with analogous 
> functionality).
>  * For a single-module project, its value should be same as *project.basedir*
>  * For multi-module project, its value should point to a project.basedir of a 
> root module
> Example:
> multi-module // located at /home/me/sources
>  +- module-a
>  +- module B
> Sample multi-module/pom.xml: 
> {{<project>}}
>  {{    <parent>}}
>  {{        <groupId>com.acme</groupId>}}
>  {{        <artifactId>corp-parent</artifactId>}}
>  {{        <version>1.0.0-RELEASE</version>}}
>  {{    </parent>}}
>  {{    <groupId>com.acme</groupId>}}
>  {{        <artifactId>multi-module</artifactId>}}
>  {{        <version>0.5.2-SNAPSHOT</version>}}
>  {{    <modules>}}
>  {{        <module>module-a</module>}}
>  {{        <module>module-b</module>}}
>  {{    </modules>}}
>  {{</project>}}
> The property requested should return /home/me/sources/multi-module, 
> regardless of whether it's referenced in any of the child modules (module-a, 
> module-b) or in multi-module.
> Note that multi-module itself has parent (e.g. installed in a local 
> repository), so the new property should be smart enough to detect it and 
> still point to /home/me/sources/multi-module instead of the local repository 
> where the corp-parent is installed.
> The use-case for such a property could be to have a directory for combined 
> report of static analysis tools. Typical example - jacoco combined coverage 
> reports.



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

Reply via email to