[ 
https://issues.apache.org/jira/browse/MNG-7038?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guillaume Nodet updated MNG-7038:
---------------------------------
    Description: 
This issue introduces three properties:
 * {{project.rootDirectory}}: {_}the project's directory or parent directory 
containing a {{.mvn}} subdirectory or a {{pom.xml}} flagged with the 
{{root="true"}} attribute{_}. If no such directory can be found, accessing the 
rootDirectory property will throw an `IllegalStateException`.

 * {{session.topDirectory}} : {_}the directory of the topmost project being 
built, usually the current directory or the directory pointed at by the 
{{\-f}}/{{\-\-file}} command line argument{_}. The {{topDirectory}} is similar 
to the {{executionRootDirectory}} property available on the session, but 
renamed to make it coherent with the new {{rootDirectory}} and to avoid using 
_root_ in its name. The {{topDirectory}} property is computed by the CLI as the 
directory pointed at by the {{\-f}}/{{\-\-file}} command line argument, or the 
current directory if there's no such argument.

 * {{session.rootDirectory}} : {_}the rootDirectory for the topDirectory 
project{_}.

The {{topDirectory}} and {{rootDirectory}} properties are made available on the 
{{MavenSession}} / {{Session}} and deprecate the {{executionRootDirectory}} and 
{{multiModuleProjectDirectory}} properties. The {{rootDirectory}} should never 
change for a given project and is thus made available for profile activation 
and model interpolation (without the {{project.}} prefix, similar to 
{{basedir}}). The goal is also to make the {{rootDirectory}} property also 
available during [command line arguments 
interpolation|https://issues.apache.org/jira/browse/MNG-6303].

A {{root}} boolean attribute is also added to the model to indicate that the 
project is the root project. This attribute is only supported if the 
_buildconsumer_ feature is active and removed before the pom is installed or 
deployed. It can be used as an alternative mechanism to the {{.mvn}} directory.

  was:
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.


> 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
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: 4.0.0-alpha-6
>
>
> This issue introduces three properties:
>  * {{project.rootDirectory}}: {_}the project's directory or parent directory 
> containing a {{.mvn}} subdirectory or a {{pom.xml}} flagged with the 
> {{root="true"}} attribute{_}. If no such directory can be found, accessing 
> the rootDirectory property will throw an `IllegalStateException`.
>  * {{session.topDirectory}} : {_}the directory of the topmost project being 
> built, usually the current directory or the directory pointed at by the 
> {{\-f}}/{{\-\-file}} command line argument{_}. The {{topDirectory}} is 
> similar to the {{executionRootDirectory}} property available on the session, 
> but renamed to make it coherent with the new {{rootDirectory}} and to avoid 
> using _root_ in its name. The {{topDirectory}} property is computed by the 
> CLI as the directory pointed at by the {{\-f}}/{{\-\-file}} command line 
> argument, or the current directory if there's no such argument.
>  * {{session.rootDirectory}} : {_}the rootDirectory for the topDirectory 
> project{_}.
> The {{topDirectory}} and {{rootDirectory}} properties are made available on 
> the {{MavenSession}} / {{Session}} and deprecate the 
> {{executionRootDirectory}} and {{multiModuleProjectDirectory}} properties. 
> The {{rootDirectory}} should never change for a given project and is thus 
> made available for profile activation and model interpolation (without the 
> {{project.}} prefix, similar to {{basedir}}). The goal is also to make the 
> {{rootDirectory}} property also available during [command line arguments 
> interpolation|https://issues.apache.org/jira/browse/MNG-6303].
> A {{root}} boolean attribute is also added to the model to indicate that the 
> project is the root project. This attribute is only supported if the 
> _buildconsumer_ feature is active and removed before the pom is installed or 
> deployed. It can be used as an alternative mechanism to the {{.mvn}} 
> directory.



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

Reply via email to