[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171886117


##
maven-model-builder/src/main/java/org/apache/maven/model/root/DefaultRootLocator.java:
##
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.model.root;
+
+import javax.inject.Named;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.codehaus.plexus.util.xml.pull.MXParser;
+
+@Named
+public class DefaultRootLocator implements RootLocator {
+
+public boolean isRootDirectory(Path dir) {
+if (Files.isDirectory(dir.resolve(".mvn"))) {
+return true;
+}
+// we're too early to use the modelProcessor ...
+Path pom = dir.resolve("pom.xml");
+try (InputStream is = Files.newInputStream(pom)) {
+MXParser parser = new MXParser();
+parser.setInput(is, null);
+if (parser.nextTag() == MXParser.START_TAG && 
parser.getName().equals("project")) {
+for (int i = 0; i < parser.getAttributeCount(); i++) {
+if ("root".equals(parser.getAttributeName(i))) {
+return 
Boolean.parseBoolean(parser.getAttributeValue(i));
+}
+}
+}
+} catch (Exception e) {

Review Comment:
   > It should be possible to catch more specific exceptions here.
   
   Fixed





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1515307978

   @gnodet Please don't forget to update the commit summary and JIRA summary 
since the property names have changed.




> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

elharo commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171728775


##
maven-model-builder/src/main/java/org/apache/maven/model/root/DefaultRootLocator.java:
##
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.model.root;
+
+import javax.inject.Named;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.codehaus.plexus.util.xml.pull.MXParser;
+
+@Named
+public class DefaultRootLocator implements RootLocator {
+
+public boolean isRootDirectory(Path dir) {
+if (Files.isDirectory(dir.resolve(".mvn"))) {
+return true;
+}
+// we're too early to use the modelProcessor ...
+Path pom = dir.resolve("pom.xml");
+try (InputStream is = Files.newInputStream(pom)) {
+MXParser parser = new MXParser();
+parser.setInput(is, null);
+if (parser.nextTag() == MXParser.START_TAG && 
parser.getName().equals("project")) {
+for (int i = 0; i < parser.getAttributeCount(); i++) {
+if ("root".equals(parser.getAttributeName(i))) {
+return 
Boolean.parseBoolean(parser.getAttributeValue(i));
+}
+}
+}
+} catch (Exception e) {

Review Comment:
   It should be possible to catch more specific exceptions here.





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171642600


##
maven-model-builder/src/main/java/org/apache/maven/model/root/DefaultRootLocator.java:
##
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.model.root;
+
+import javax.inject.Named;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.codehaus.plexus.util.xml.pull.MXParser;
+
+@Named
+public class DefaultRootLocator implements RootLocator {
+
+public boolean isRootDirectory(Path dir) {
+if (Files.isDirectory(dir.resolve(".mvn"))) {
+return true;
+}
+// we're too early to use the modelProcessor ...
+Path pom = dir.resolve("pom.xml");
+try (InputStream is = Files.newInputStream(pom)) {
+MXParser parser = new MXParser();
+parser.setInput(is, null);
+if (parser.nextTag() == MXParser.START_TAG && 
parser.getName().equals("project")) {
+for (int i = 0; i < parser.getAttributeCount(); i++) {
+if ("root".equals(parser.getAttributeName(i))) {
+return 
Boolean.parseBoolean(parser.getAttributeValue(i));
+}
+}
+}
+} catch (Exception e) {
+// Ignore

Review Comment:
   Comment added.





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171610999


##
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##
@@ -324,10 +324,14 @@ void initialize(CliRequest cliRequest) throws 
ExitException {
 }
 }
 
+// We need to locate the top level project which may be pointed at 
using
+// the -f/--file option.  However, the command line isn't parsed yet, 
so
+// we need to iterator through the args to find it and act upon it.

Review Comment:
   iterate





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171609823


##
maven-model-builder/src/main/java/org/apache/maven/model/root/DefaultRootLocator.java:
##
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.model.root;
+
+import javax.inject.Named;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.codehaus.plexus.util.xml.pull.MXParser;
+
+@Named
+public class DefaultRootLocator implements RootLocator {
+
+public boolean isRootDirectory(Path dir) {
+if (Files.isDirectory(dir.resolve(".mvn"))) {
+return true;
+}
+// we're too early to use the modelProcessor ...
+Path pom = dir.resolve("pom.xml");
+try (InputStream is = Files.newInputStream(pom)) {
+MXParser parser = new MXParser();
+parser.setInput(is, null);
+if (parser.nextTag() == MXParser.START_TAG && 
parser.getName().equals("project")) {
+for (int i = 0; i < parser.getAttributeCount(); i++) {
+if ("root".equals(parser.getAttributeName(i))) {
+return 
Boolean.parseBoolean(parser.getAttributeValue(i));
+}
+}
+}
+} catch (Exception e) {
+// Ignore

Review Comment:
   Yes, depicting that a later stage will handle this better





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1515057891

   > > Looks much better now. Will try this with the IT you have written.
   > 
   > I can also deprecate `basedir` and add a `baseDirectory`, but this may be 
better located in a subsequent PR.
   
   Let's move this to new PR where a separate ticket will make it visible. 




> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171542519


##
maven-model-builder/src/main/java/org/apache/maven/model/root/DefaultRootLocator.java:
##
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.model.root;
+
+import javax.inject.Named;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.codehaus.plexus.util.xml.pull.MXParser;
+
+@Named
+public class DefaultRootLocator implements RootLocator {
+
+public boolean isRootDirectory(Path dir) {
+if (Files.isDirectory(dir.resolve(".mvn"))) {
+return true;
+}
+// we're too early to use the modelProcessor ...
+Path pom = dir.resolve("pom.xml");
+try (InputStream is = Files.newInputStream(pom)) {
+MXParser parser = new MXParser();
+parser.setInput(is, null);
+if (parser.nextTag() == MXParser.START_TAG && 
parser.getName().equals("project")) {
+for (int i = 0; i < parser.getAttributeCount(); i++) {
+if ("root".equals(parser.getAttributeName(i))) {
+return 
Boolean.parseBoolean(parser.getAttributeValue(i));
+}
+}
+}
+} catch (Exception e) {
+// Ignore

Review Comment:
   I can add a comment :-)





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > Looks much better now. Will try this with the IT you have written.
   
   I can also deprecate `basedir` and add a `baseDirectory`, but this may be 
better located in a subsequent PR.




> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171534446


##
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##
@@ -320,6 +324,49 @@ void initialize(CliRequest cliRequest) throws 
ExitException {
 }
 }
 
+Path topDirectory = Paths.get(cliRequest.workingDirectory);
+boolean isAltFile = false;
+for (String arg : cliRequest.args) {
+if (isAltFile) {
+Path path = Paths.get(arg);
+if (Files.isDirectory(path)) {
+topDirectory = path;
+} else if (Files.isRegularFile(topDirectory)) {
+topDirectory = path.getParent();
+if (!Files.isDirectory(topDirectory)) {
+System.err.println("Directory " + topDirectory
++ " extracted from the -f/--file command-line 
argument " + arg + " does not exist");
+throw new ExitException(1);
+}
+} else {
+System.err.println(
+"POM file " + arg + " specified with the -f/--file 
command line argument does not exist");
+throw new ExitException(1);
+}
+break;
+} else {
+isAltFile = 
arg.equals(String.valueOf(CLIManager.ALTERNATE_POM_FILE)) || arg.equals("file");

Review Comment:
   Added some comments.





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171526547


##
maven-model-builder/src/main/java/org/apache/maven/model/root/DefaultRootLocator.java:
##
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.model.root;
+
+import javax.inject.Named;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.codehaus.plexus.util.xml.pull.MXParser;
+
+@Named
+public class DefaultRootLocator implements RootLocator {
+
+public boolean isRootDirectory(Path dir) {
+if (Files.isDirectory(dir.resolve(".mvn"))) {
+return true;
+}
+// we're too early to use the modelProcessor ...
+Path pom = dir.resolve("pom.xml");
+try (InputStream is = Files.newInputStream(pom)) {
+MXParser parser = new MXParser();
+parser.setInput(is, null);
+if (parser.nextTag() == MXParser.START_TAG && 
parser.getName().equals("project")) {
+for (int i = 0; i < parser.getAttributeCount(); i++) {
+if ("root".equals(parser.getAttributeName(i))) {
+return 
Boolean.parseBoolean(parser.getAttributeValue(i));
+}
+}
+}
+} catch (Exception e) {
+// Ignore

Review Comment:
   Not sure how to handle that.  If there's really `pom.xml` file which is not 
readable / parseable, the build should fail a bit later with a cleaner 
exception that we can display here.
   That's why I decided to go this way.  The problem is that doing it in a 
cleaner way will involve differentiating what can be ignored and what errors 
should be displayed to the user, and how to display them, and whether this 
should fail the build or not.  Also, even the check is minimalist as we don't 
check the namespace.
   What would you suggest ?





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171516507


##
maven-model-builder/src/main/java/org/apache/maven/model/root/DefaultRootLocator.java:
##
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.model.root;
+
+import javax.inject.Named;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.codehaus.plexus.util.xml.pull.MXParser;
+
+@Named
+public class DefaultRootLocator implements RootLocator {
+
+public boolean isRootDirectory(Path dir) {
+if (Files.isDirectory(dir.resolve(".mvn"))) {
+return true;
+}
+// we're too early to use the modelProcessor ...
+Path pom = dir.resolve("pom.xml");
+try (InputStream is = Files.newInputStream(pom)) {
+MXParser parser = new MXParser();
+parser.setInput(is, null);
+if (parser.nextTag() == MXParser.START_TAG && 
parser.getName().equals("project")) {
+for (int i = 0; i < parser.getAttributeCount(); i++) {
+if ("root".equals(parser.getAttributeName(i))) {
+return 
Boolean.parseBoolean(parser.getAttributeValue(i));
+}
+}
+}
+} catch (Exception e) {
+// Ignore

Review Comment:
   Can we really swallow this?





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171512493


##
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##
@@ -320,6 +324,49 @@ void initialize(CliRequest cliRequest) throws 
ExitException {
 }
 }
 
+Path topDirectory = Paths.get(cliRequest.workingDirectory);
+boolean isAltFile = false;
+for (String arg : cliRequest.args) {
+if (isAltFile) {
+Path path = Paths.get(arg);
+if (Files.isDirectory(path)) {
+topDirectory = path;
+} else if (Files.isRegularFile(topDirectory)) {
+topDirectory = path.getParent();
+if (!Files.isDirectory(topDirectory)) {
+System.err.println("Directory " + topDirectory
++ " extracted from the -f/--file command-line 
argument " + arg + " does not exist");
+throw new ExitException(1);
+}
+} else {
+System.err.println(
+"POM file " + arg + " specified with the -f/--file 
command line argument does not exist");
+throw new ExitException(1);
+}
+break;
+} else {
+isAltFile = 
arg.equals(String.valueOf(CLIManager.ALTERNATE_POM_FILE)) || arg.equals("file");

Review Comment:
   Aha, then a comment should accompany that code,





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171483867


##
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##
@@ -320,6 +324,49 @@ void initialize(CliRequest cliRequest) throws 
ExitException {
 }
 }
 
+Path topDirectory = Paths.get(cliRequest.workingDirectory);
+boolean isAltFile = false;
+for (String arg : cliRequest.args) {
+if (isAltFile) {
+Path path = Paths.get(arg);
+if (Files.isDirectory(path)) {
+topDirectory = path;
+} else if (Files.isRegularFile(topDirectory)) {
+topDirectory = path.getParent();
+if (!Files.isDirectory(topDirectory)) {
+System.err.println("Directory " + topDirectory
++ " extracted from the -f/--file command-line 
argument " + arg + " does not exist");
+throw new ExitException(1);
+}
+} else {
+System.err.println(
+"POM file " + arg + " specified with the -f/--file 
command line argument does not exist");
+throw new ExitException(1);
+}
+break;
+} else {
+isAltFile = 
arg.equals(String.valueOf(CLIManager.ALTERNATE_POM_FILE)) || arg.equals("file");

Review Comment:
   Well, the CLI isn't built yet, this is really one of the first things done.  
Also the point is to be able to leverage those properties during argument 
interpolation (see https://github.com/apache/maven/pull/1062), so this really 
has to be done very early.





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171338733


##
api/maven-api-core/src/main/java/org/apache/maven/api/Project.java:
##
@@ -86,8 +86,42 @@ default String getId() {
 return getModel().getId();
 }
 
+/**
+ * @deprecated use {@link #isTopProject()} instead
+ */
+@Deprecated
 boolean isExecutionRoot();
 
+/**
+ * Returns a boolean indicating if the project is the top level project for
+ * this reactor build.  The top level project may be different from the
+ * {@code rootDirProject}, especially if a subtree of the project is being

Review Comment:
   missed this one



##
api/maven-api-core/src/main/java/org/apache/maven/api/Project.java:
##
@@ -86,8 +86,42 @@ default String getId() {
 return getModel().getId();
 }
 
+/**
+ * @deprecated use {@link #isTopProject()} instead
+ */
+@Deprecated
 boolean isExecutionRoot();
 
+/**
+ * Returns a boolean indicating if the project is the top level project for
+ * this reactor build.  The top level project may be different from the
+ * {@code rootDirProject}, especially if a subtree of the project is being
+ * built, either because Maven has been launched in a subdirectory or using
+ * a {@code -f} option.
+ *
+ * @return {@code true} if the project is the top level project for this 
build
+ */
+boolean isTopProject();
+
+/**
+ * Returns a boolean indicating if the project is a root project,
+ * meaning that .

Review Comment:
   incomplete



##
maven-model-builder/src/main/java/org/apache/maven/model/root/RootLocator.java:
##
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.model.root;
+
+import java.nio.file.Path;
+
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+
+/**
+ * Interface used to locate the root directory for a given project.
+ *
+ * The root locator is usually looked up from the plexus container.
+ * One notable exception is the computation of the early {@code 
session.rootDirectory}
+ * property which happens very early.  The implementation used in this case
+ * will be discovered using the JDK service mechanism.
+ *
+ * The default implementation will look for a {@code .mvn} child directory
+ * or a {@code pom.xml} containing the {@code root="true"} attribute.
+ *
+ * @see DefaultRootLocator
+ */
+public interface RootLocator {
+
+String UNABLE_TO_FIND_ROOT_PROJECT_MESSAGE = "Unable to find the root 
directory. "
++ "Create a .mvn directory in the root directory or add the 
root=\"true\""
++ " attribute on the root project's model to identify it.";
+
+@Nonnull
+default Path findMandatoryRoot(Path basedir) {
+Path rootDirectory = findRoot(basedir);
+if (rootDirectory == null) {
+throw new IllegalStateException(getNoRootMessage());
+}
+return rootDirectory;
+}
+
+@Nullable
+default Path findRoot(Path basedir) {
+Path rootDirectory = basedir;
+while (rootDirectory != null && !isRootDir(rootDirectory)) {
+rootDirectory = rootDirectory.getParent();
+}
+return rootDirectory;
+}
+
+@Nonnull
+default String getNoRootMessage() {
+return UNABLE_TO_FIND_ROOT_PROJECT_MESSAGE;
+}
+
+boolean isRootDir(Path dir);

Review Comment:
   missed this one



##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,51 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+

[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171331743


##
maven-model-builder/src/site/apt/index.apt:
##
@@ -183,13 +183,17 @@ Maven Model Builder
 | <<>>\
 <<>> () | the directory containing the <<>> 
file as URI | <<<$\{project.baseUri\}>>> |
 *+--+--+
+| <<>> | the project's root directory (containing a 
<<<.mvn>>> directory or with the <<>> xml attribute | 
<<<$\{project.rootdir\}>>> |
+*+--+--+
 | <<>>\
 <<>> | the UTC timestamp of build start, in 
<<>> default format, which can be overridden with 
<<>> POM property | 
<<<$\{maven.build.timestamp\}>>> |
 *+--+--+
 | <<<*>>> | user properties, set from CLI with <<<-Dproperty=value>>> | 
<<<$\{skipTests\}>>> |
 *+--+--+
 | <<<*>>> | model properties, such as project properties set in the pom | 
<<<$\{any.key\}>>> |
 *+--+--+
+| <<>> | the directory containing the root <<>> 
file, identified by the existence of a <<<.mvn>>> child directory | 
<<<$\{session.rootdir\}>>> |
+*+--+--+

Review Comment:
   Right, my bad!





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171253490


##
maven-model-builder/src/site/apt/index.apt:
##
@@ -183,13 +183,17 @@ Maven Model Builder
 | <<>>\
 <<>> () | the directory containing the <<>> 
file as URI | <<<$\{project.baseUri\}>>> |
 *+--+--+
+| <<>> | the project's root directory (containing a 
<<<.mvn>>> directory or with the <<>> xml attribute | 
<<<$\{project.rootdir\}>>> |
+*+--+--+
 | <<>>\
 <<>> | the UTC timestamp of build start, in 
<<>> default format, which can be overridden with 
<<>> POM property | 
<<<$\{maven.build.timestamp\}>>> |
 *+--+--+
 | <<<*>>> | user properties, set from CLI with <<<-Dproperty=value>>> | 
<<<$\{skipTests\}>>> |
 *+--+--+
 | <<<*>>> | model properties, such as project properties set in the pom | 
<<<$\{any.key\}>>> |
 *+--+--+
+| <<>> | the directory containing the root <<>> 
file, identified by the existence of a <<<.mvn>>> child directory | 
<<<$\{session.rootdir\}>>> |
+*+--+--+

Review Comment:
   `session.topdir` depends on the current directory so it should not be used 
during profile activation or model interpolation.  The `session.rootdir` 
property depends on `session.topdir` and thus should not be made available 
either.  Those two properties are available for profile injection, but this 
page is about the model building phase, which should be limited to 
`project.rootDirectory`.





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1171150547


##
maven-model-builder/src/site/apt/index.apt:
##
@@ -183,13 +183,17 @@ Maven Model Builder
 | <<>>\
 <<>> () | the directory containing the <<>> 
file as URI | <<<$\{project.baseUri\}>>> |
 *+--+--+
+| <<>> | the project's root directory (containing a 
<<<.mvn>>> directory or with the <<>> xml attribute | 
<<<$\{project.rootdir\}>>> |
+*+--+--+
 | <<>>\
 <<>> | the UTC timestamp of build start, in 
<<>> default format, which can be overridden with 
<<>> POM property | 
<<<$\{maven.build.timestamp\}>>> |
 *+--+--+
 | <<<*>>> | user properties, set from CLI with <<<-Dproperty=value>>> | 
<<<$\{skipTests\}>>> |
 *+--+--+
 | <<<*>>> | model properties, such as project properties set in the pom | 
<<<$\{any.key\}>>> |
 *+--+--+
+| <<>> | the directory containing the root <<>> 
file, identified by the existence of a <<<.mvn>>> child directory | 
<<<$\{session.rootdir\}>>> |
+*+--+--+

Review Comment:
   Where is the documentation for the top directory?





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-18 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

elharo commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1512925510

   > Should that imply that the properties become `project.rootDirectory`, 
`session.rootDirectory` and `session.topDirectory` ?
   > I think people are used to `basedir` so I wanted to align with it and make 
things coherent. If so, I'd rename that one to `project.baseDirectory` too.
   
   I do not think consistency is the most important virtue here. If these are 
new properties in 4.0, then by all means name the properties rootDirectory, 
topDirectory, etc. or perhaps some case variant of that like root_directory. I 
think basedir already exists so I wouldn't rename it. 
   
   My general train of thought is to make the API and properties as clean and 
readable as possible, even if that introduces some inconsistencies with older 
API that does not follow best practices.  
   




> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-18 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

elharo commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1169894357


##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,51 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File getMultiModuleProjectDirectory();
 
+/**
+ * Sets the top dir of the project.

Review Comment:
   "directory" and that's even if the name remains setTopdir



##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,51 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File getMultiModuleProjectDirectory();
 
+/**
+ * Sets the top dir of the project.
+ *
+ * @since 4.0.0
+ */
+MavenExecutionRequest setTopdir(Path topdir);
+
+/**
+ * Gets the directory of the topmost project being built, usually the 
current directory or the
+ * directory pointed at by the {@code -f/--file} command line argument.
+ *
+ * @since 4.0.0
+ */
+Path getTopdir();
+
+/**
+ * Sets the root dir of the project.

Review Comment:
   directory





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-18 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1512609631

   > > > I think as far as @elharo's comments are concerned, he's right. Names 
should be written out, i.e., `getRootDirectory()`, `getTopDirectory()`, etc.
   > > 
   > > 
   > > Should that imply that the properties become `project.rootDirectory`, 
`session.rootDirectory` and `session.topDirectory` ? I think people are used to 
`basedir` so I wanted to align with it and make things coherent. If so, I'd 
rename that one to `project.baseDirectory` too.
   > 
   > I wouldn't touch the properties, only Java code. But if the properties 
_map_ to Java code, then this is a problem, of course. Is this the case?
   
   @elharo, please tell us what you think about this inconsistency.




> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-17 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1511943122

   > > I think as far as @elharo's comments are concerned, he's right. Names 
should be written out, i.e., `getRootDirectory()`, `getTopDirectory()`, etc.
   > 
   > Should that imply that the properties become `project.rootDirectory`, 
`session.rootDirectory` and `session.topDirectory` ? I think people are used to 
`basedir` so I wanted to align with it and make things coherent. If so, I'd 
rename that one to `project.baseDirectory` too.
   
   I wouldn't touch the properties, only Java code. But if the properties *map* 
to Java code, then this is a problem, of course. Is this the case?




> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-17 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > I think as far as @elharo's comments are concerned, he's right. Names 
should be written out, i.e., `getRootDirectory()`, `getTopDirectory()`, etc.
   
   Should that imply that the properties become `project.rootDirectory`, 
`session.rootDirectory` and `session.topDirectory` ?  
   I think people are used to `basedir` so I wanted to align with it and make 
things coherent. If so, I'd rename that one to `project.baseDirectory` too.




> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-17 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1511890977

   I think as far as @elharo's comments are concerned, he's right. Names should 
be written out, i.e., `getRootDirectory()`, `getTopDirectory()`, etc.




> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-14 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1508241579

   I'll try to review this weekend.




> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-14 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   I'm done with the changes and added an 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
>Assignee: Guillaume Nodet
>Priority: Major
> Fix For: 4.0.0-alpha-6
>
>
> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-14 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1166567100


##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,49 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File getMultiModuleProjectDirectory();
 
+/**
+ * Sets the root dir of the project.
+ *
+ * @since 4.0.0
+ */
+MavenExecutionRequest setRootdir(Path rootdir);
+
+/**
+ * Gets the root dir of the project, which is the up-most directory of the 
reactor, usually containing
+ * the {@code .mvn} directory.
+ *
+ * @since 4.0.0
+ */
+Path getRootdir();
+
+/**
+ * Sets the top dir of the project.
+ *
+ * @since 4.0.0
+ */
+MavenExecutionRequest setTopdir(Path topdir);
+
+/**
+ * Gets the top dir of the project, which is the up-most directory of the 
reactor projects.

Review Comment:
   I've removed the confusing part.





> 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 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-12 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1163893091


##
maven-core/src/main/java/org/apache/maven/project/MavenProject.java:
##
@@ -1679,4 +1681,13 @@ public ProjectBuildingRequest 
getProjectBuildingRequest() {
 public void setProjectBuildingRequest(ProjectBuildingRequest 
projectBuildingRequest) {
 this.projectBuilderConfiguration = projectBuildingRequest;
 }
+
+/**
+ * @since 4.0.0
+ * @return the rootdir for this project
+ * @throws IllegalArgumentException if the rootdir cannot be found
+ */
+public Path getRootdir() {
+return new DefaultRootLocator().locateMandatoryRoot(basedir != null ? 
basedir.toPath() : null);
+}

Review Comment:
   I think that's wrong.  We should not be lazy here and the use of `new 
DefaultRootLocator()` is wrong.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-12 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1163863120


##
api/maven-api-core/src/main/java/org/apache/maven/api/Project.java:
##
@@ -116,6 +116,16 @@ default String getId() {
  */
 boolean isRootProject();
 
+/**
+ * Gets the root directory of the project, which is the parent directory 
containing the {@code .mvn} directory
+ * or flagged with {@code root="true"}. If there's no such file, an {@code 
IllegalStateException} will be thrown.

Review Comment:
   The last sentence duplicates the `@throws`



##
api/maven-api-core/src/main/java/org/apache/maven/api/Session.java:
##
@@ -101,6 +92,17 @@ public interface Session {
 @Nonnull
 Path getTopdir();
 
+/**
+ * Gets the root directory of the session, which is the root directory for 
the topdir project.
+ * If there's no such file, an {@code IllegalStateException} will be 
thrown.

Review Comment:
   same here



##
maven-core/src/main/java/org/apache/maven/project/MavenProject.java:
##
@@ -1679,4 +1681,13 @@ public ProjectBuildingRequest 
getProjectBuildingRequest() {
 public void setProjectBuildingRequest(ProjectBuildingRequest 
projectBuildingRequest) {
 this.projectBuilderConfiguration = projectBuildingRequest;
 }
+
+/**
+ * @since 4.0.0
+ * @return the rootdir for this project
+ * @throws IllegalArgumentException if the rootdir cannot be found

Review Comment:
   Here it is IAE but else ISE?





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-08 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1500819070

   @gnodet issue is that we likely dont want a "subroot" being a root 
(plugin/prop override with syst prop) with uberagg but guess we can put this 
case aside for now since interpolation on user props should make it smooth and 
these props would use root dir placeholder in its default so LGTM like that




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   I think we should make the `rootdir` property available from the _project_ 
rather than from the _session_.  If we want to support über-aggregations, we 
should prepare for each project to have a different _rootdir_.
   The current `session.rootdir` would only be the `rootdir` for the _top 
project_.
   Consider the following:
   ```
   a
|- b
|   \- c
\- d
\- e
   ```
   where _b_ and _d_ are GitHub repositories and _a_ is a project aggregating 
_b_ and _d_.  In this case, _c_ rootdir should point to _b_ and _e_ rootdir 
should point to _d_.  If we don't do this, projects would be build differently 
because the rootdir would point to _a_, which could be really bad.
   
   I'm going to add a `getRootdir()` on `Project` and make sure that this one 
is used when interpolating projects or injecting mojos.  This would not affect 
early usage of the `rootdir` property obviously.
   
   The other possibility is to clearly document the limitation and that 
projects using `rootdir` may not be properly aggregated (which is the case 
currently for projects using the `maven.multiModuleProjectDirectory` or other 
mechanisms), but if that could be fixed as well...
   




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1160912659


##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,51 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File getMultiModuleProjectDirectory();
 
+/**
+ * Sets the root dir of the project.
+ *
+ * @since 4.0.0
+ */
+MavenExecutionRequest setRootdir(Path rootdir);
+
+/**
+ * Gets the root directory of the project, which is the parent directory 
containing the {@code .mvn} directory
+ * or a {@code pom.xml} file with the {@code root="true"} attribute.
+ * If there's no such file, an {@code IllegalStateException} will be 
thrown.
+ *
+ * @throws IllegalStateException if the root directory could not be found
+ * @since 4.0.0
+ */
+Path getRootdir() throws IllegalStateException;

Review Comment:
   Fixed





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > > Some of the use cases involve arguments interpolation, so this has to be 
done very early in the process.
   > 
   > That are probably just other use-cases that where requested! I just wanted 
remind of the original request, that only wanted to make `multiModuleDirectory` 
official to be **used inside a pom**, it was never asked to work on commandline 
arguments, and at the point where the **model(!)** is read the location is well 
known and there are no inconsistency and it is early enough for this use-case.
   
   JIRA seems down for me, but I can point to MNG-5659 or 
https://github.com/apache/maven-mvnd/issues/813#issuecomment-1466916434
   
   > > Also, I disagree that this is weird somehow. I think it's actually 
mapping quite well with the property isRootProject()
   > 
   > I think you mean 
`org.apache.maven.project.MavenProject.isExecutionRoot()`? Beside from Maven 
developers I assume no one ever has heard of it and I can't find the term in 
the current maven documentation anywhere. Beside that, its currently defined as 
the project that is the one where I executed maven.
   
   I was referring to 
https://github.com/apache/maven/pull/1061/files#diff-5e32d3e141f6d87a19ff7f26d7ff4f2d427a8d98622e71ef24a1168772d23e13R117
   




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1500462903

   > I do not feel very comfortable to add runtime information into a static 
model. This does not feel right. Maybe we should just require `.mvn` to be 
present now, period?
   
   Strictly speaking it is as runtime as the gav of the pom so this part is 
fine IMHO.
   
   Current proposal looks good and avoids the pitfall `.mvn` presence will 
imply so looks good to me.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

laeubi commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1500441953

   > Some of the use cases involve arguments interpolation, so this has to be 
done very early in the process.
   
   That are probably just other use-cases that where requested! I just wanted 
remind of the original request, that only wanted to make `multiModuleDirectory` 
official to be **used inside a pom**, it was never asked to work on commandline 
arguments, and at the point where the **model(!)** is read the location is well 
known and there are no inconsistency and it is early enough for this use-case.
   
   > Also, I disagree that this is weird somehow. I think it's actually mapping 
quite well with the property isRootProject() 
   
   I think you mean `org.apache.maven.project.MavenProject.isExecutionRoot()`? 
Beside from Maven developers I assume no one ever has heard of it and I can't 
find the term in the current maven documentation anywhere. Beside that, its 
currently defined as the project that is the one where I executed maven.
   
   




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > > > I do not feel very comfortable to add runtime information into a 
static model. This does not feel right. Maybe we should just require `.mvn` to 
be present now, period?
   > > 
   > > 
   > > I'll let you discuss with @rmannibucau about that, because that's 
precisely the very point he disagree with...
   > 
   > My feeling is that hes the only one disagreeing here, so maybe we can not 
make everyone happy ;-) Beside that i find "root" confusing if it is only used 
to define a path but has no other meaning.
   > 
   > Also as an excerpt from the discussion, I think that almost all use-cases 
would better to have a property that has the full path of the current **pom.xml 
file** (!).
   > 
   > So lets say I have a parent `pom.xml` and I use the property 
`${this.location}` it should always resolve to the path of the parent pom even 
if used in a child at any level. Thats simple and can be used independent of 
the project structure.
   
   Some of the use cases involve arguments interpolation, so this has to be 
done _very early_ in the process.
   
   Also, I disagree that this is _weird_ somehow.  I think it's actually 
mapping quite well with the property `isRootProject()` which has already been 
added to the `Project`, and actually nicely reflects the correct semantic and 
what we're looking for.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

laeubi commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1500421719

   > > I do not feel very comfortable to add runtime information into a static 
model. This does not feel right. Maybe we should just require `.mvn` to be 
present now, period?
   > 
   > I'll let you discuss with @rmannibucau about that, because that's 
precisely the very point he disagree with...
   
   My feeling is that hes the only one disagreeing here, so maybe we can not 
make everyone happy ;-)
   Beside that i find "root" confusing if it is only used to define a path but 
has no other meaning.
   
   Also as an excerpt from the discussion, I think that almost all use-cases 
would better to have a property that has the full path of the current **pom.xml 
file** (!).
   
   So lets say I have a parent `pom.xml` and I use the property 
`${this.location}` it should always resolve to the path of the parent pom even 
if used in a child at any level. Thats simple and can be used independent of 
the project structure.
   
   




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1160802840


##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,51 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File getMultiModuleProjectDirectory();
 
+/**
+ * Sets the root dir of the project.
+ *
+ * @since 4.0.0
+ */
+MavenExecutionRequest setRootdir(Path rootdir);
+
+/**
+ * Gets the root directory of the project, which is the parent directory 
containing the {@code .mvn} directory
+ * or a {@code pom.xml} file with the {@code root="true"} attribute.
+ * If there's no such file, an {@code IllegalStateException} will be 
thrown.
+ *
+ * @throws IllegalStateException if the root directory could not be found
+ * @since 4.0.0
+ */
+Path getRootdir() throws IllegalStateException;

Review Comment:
   The documentation is already present in Javadoc. We don't declare REs 
anywhere, but Javadoc. It should be consistent throughout.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > I do not feel very comfortable to add runtime information into a static 
model. This does not feel right. Maybe we should just require `.mvn` to be 
present now, period?
   
   I'll let you discuss with @rmannibucau about that, because that's precisely 
the very point he disagree with...




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1160797325


##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,51 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File getMultiModuleProjectDirectory();
 
+/**
+ * Sets the root dir of the project.
+ *
+ * @since 4.0.0
+ */
+MavenExecutionRequest setRootdir(Path rootdir);
+
+/**
+ * Gets the root directory of the project, which is the parent directory 
containing the {@code .mvn} directory
+ * or a {@code pom.xml} file with the {@code root="true"} attribute.
+ * If there's no such file, an {@code IllegalStateException} will be 
thrown.
+ *
+ * @throws IllegalStateException if the root directory could not be found
+ * @since 4.0.0
+ */
+Path getRootdir() throws IllegalStateException;

Review Comment:
   It's not mandatory, but definitely not redundant. That's documentation ;-)





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1160779967


##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,51 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File getMultiModuleProjectDirectory();
 
+/**
+ * Sets the root dir of the project.
+ *
+ * @since 4.0.0
+ */
+MavenExecutionRequest setRootdir(Path rootdir);
+
+/**
+ * Gets the root directory of the project, which is the parent directory 
containing the {@code .mvn} directory
+ * or a {@code pom.xml} file with the {@code root="true"} attribute.
+ * If there's no such file, an {@code IllegalStateException} will be 
thrown.
+ *
+ * @throws IllegalStateException if the root directory could not be found
+ * @since 4.0.0
+ */
+Path getRootdir() throws IllegalStateException;

Review Comment:
   That's a runtime exception and redundant in the signature.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-04-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   @michael-o @rmannibucau @cstamas  please check the recent addition of the 
`root="true"` model attribute as an alternative mechanism to locate the root 
directory.  Both are conceptually similar and the nearest  directory having 
either a `.mvn` sub-directory or a `pom.xml` flagged with this attribute will 
be used.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1489172763

   > Imho, we need this definition before parsing any project POM , else use 
cases such as https://github.com/apache/maven/pull/1059 or 
https://github.com/apache/maven/pull/1062 cannot be covered. So I'm not opposed 
to a different way of pinning, but not from pom files.
   
   For the second one it is not a technical issue AFAIK.
   For first one it looks it is a bit more nasty indeed but 
`maven.multiModuleProjectDirectory` seems fully dedicated to this lifecycle 
case and looks like having the same issues so if it will somehow assume `.mvn` 
is there, I would prefer `.mvn/jvm.config` enabling a minimum interpolation 
(`$PWD` or alike) which can be set in `jvm.config` this way user can set all 
the system props needed there and avoid the ambiguity to introduce something 
magic with a lot of corner cases.
   




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > > But the parent/child relationship has to be done later in the process, 
so can't be used for early interpolation.
   > 
   > Interpolation does not really works there anyway so no, but yes it will 
require a 2 phases processing, guess it is not a big blocker as of today. I'm 
not to add new properties, really just to get a single functional rootdir one 
(hopefully merged with multi one but if not at least reliable on any maven 
compatible projects). My definition enables to use it for checkstyles, headers 
etc even without a .mvn (whereas it works in a minority of cases - 
statistically - if not done this way). It can also work when using an 
aggregator if the pom uses properties to define paths exactly as .mvn case 
which does not solve this issue since for a project with `root > 
{child1/.mvn>subchild1,child2/.mvn>subchild2}` it will randomly take child1 or 
child2 as rootdir.
   > 
   > Side note: using .mvn also has a nasty side effect, we couldnt use it in 
nested directories for module specific configuration anymore whereas it can 
come later if we support lock files, dependency routing or other metadata per 
module we don't want to put in the pom to keep it readable. It would be a 
natural location for me.
   > 
   > Maybe thinking out loud but do we attack the issue by the right side, for 
configuration location we want to be able to pin absolutely a file (often the 
root pom), shouldn't we enable it? Main issue is that `${project.}` is 
interpolated per pom so maybe we should enable a definition pinning, ie 
`${project.definition.basedir}` - name is bad but sharing the idea - would stay 
`/opt/foo` for `/opt/foo/pom.xml` but also its child `/opt/foo/child/pom.xml`? 
This looks pretty easy to handle in interpolation and drops this `rootdir` need 
in properties for user/mojo configuration. Can it be an outcome?
   
   Imho, we need this definition before parsing any project POM , else use 
cases such as https://github.com/apache/maven/pull/1059 or 
https://github.com/apache/maven/pull/1062 cannot be covered.  So I'm not 
opposed to a different way of pinning, but not from pom files.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1489105642

   > But the parent/child relationship has to be done later in the process, so 
can't be used for early interpolation.
   
   Interpolation does not really works there anyway so no, but yes it will 
require a 2 phases processing, guess it is not a big blocker as of today.
   I'm not to add new properties, really just to get a single functional 
rootdir one (hopefully merged with multi one but if not at least reliable on 
any maven compatible projects).
   My definition enables to use it for checkstyles, headers etc even without a 
.mvn (whereas it works in a minority of cases - statistically - if not done 
this way). It can also work when using an aggregator if the pom uses properties 
to define paths exactly as .mvn case which does not solve this issue since for 
a project with `root > {child1/.mvn>subchild1,child2/.mvn>subchild2}` it will 
randomly take child1 or child2 as rootdir.
   
   
   Side note: using .mvn also has a nasty side effect, we couldnt use it in 
nested directories for module specific configuration anymore whereas it can 
come later if we support lock files, dependency routing or other metadata per 
module we don't want to put in the pom to keep it readable. It would be a 
natural location for me.
   
   Maybe thinking out loud but do we attack the issue by the right side, for 
configuration location we want to be able to pin absolutely a file (often the 
root pom), shouldn't we enable it? Main issue is that `${project.}` is 
interpolated per pom so maybe we should enable a definition pinning, ie 
`${project.definition.basedir}` - name is bad but sharing the idea - would stay 
`/opt/foo` for `/opt/foo/pom.xml` but also its child `/opt/foo/child/pom.xml`? 
This looks pretty easy to handle in interpolation and drops this `rootdir` need 
in properties for user/mojo configuration. Can it be an outcome?




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > So this PR just duplicates the properties we have without solving any new 
feature but does it differently from before. Git is different because the 
bubbling is cleaner whereas .mvn is an user dir pushed to the repos (compared 
to git which is not) and this is what breaks current impl as explained (agree 
it i as much as parent/child impl but as much both ways). If we can't do better 
than what we have today, let's keep/enhance what we have instead of creating 
something very confusing for end user and not better in terms of reliability 
(which prop to use being said none is really what I want or has side effects).
   > 
   > > If you aggregate projects using submodules in a bigger aggregator, the 
definition of the rootdir indicates it won't bubble up, and that's definitely 
what we want, else the project build may fail locating files that are pointed 
to.
   > 
   > Hmm, you can make it run in both case depending how you define it (with 
.mvn in root but not children or with in children), so you still have broken 
cases. If you aggregate you will get a single rootdir..so it is broken as soon 
as you get 2 subprojects - actually one since parent will not have its rootdir 
cleanly set.
   > 
   > Ideally we need a marker to set the root dir, we could use git as 
inspiration and force the presence of a `.mvn/.mvn_meta` which would be handled 
at "clone"/setup time somehow (do we fail if this file is missing, how do we 
ensure it is not committed and experience is smooth when a project is cloned?).
   > 
   > The parent/child resolution + filtering to ensure the resolution does not 
use .m2/remote is still way more reliable IMHO since it always works to get a 
deterministic rootdir. Only case it is broken is when the child does not 
reference the parent but then the intent of the user was to be able to run 
either from the parent (rootdir=parent) or child only (rootdir=child) so we 
always exactly match the intent whereas with .mvn we have several counter 
examples since the presence is optional.
   
   But the parent/child relationship has to be done later in the process, so 
can't be used for early interpolation.If you can come up with a nice 
definition, we can define additional properties.  Although, those are already 
available from various plugins, so not sure we do actually need them, unless 
there is pressing needs, but I still don't grab the use case for those.  For 
example, they could not be used to locate checkstyle rules, headers files and 
such, as those have to be local to the project when aggregated in a bigger 
reactor. For those, the `.mvn` does work reliably.  So what's your use case ?




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1489045762

   So this PR just duplicates the properties we have without solving any new 
feature but does it differently from before.
   Git is different because the bubbling is cleaner whereas .mvn is an user dir 
pushed to the repos (compared to git which is not) and this is what breaks 
current impl as explained (agree it i as much as parent/child impl but as much 
both ways).
   If we can't do better than what we have today, let's keep/enhance what we 
have instead of creating something very confusing for end user and not better 
in terms of reliability (which prop to use being said none is really what I 
want or has side effects).
   
   >  If you aggregate projects using submodules in a bigger aggregator, the 
definition of the rootdir indicates it won't bubble up, and that's definitely 
what we want, else the project build may fail locating files that are pointed 
to. 
   
   Hmm, you can make it run in both case depending how you define it (with .mvn 
in root but not children or with in children), so you still have broken cases.
   If you aggregate you will get a single rootdir..so it is broken as soon as 
you get 2 subprojects - actually one since parent will not have its rootdir 
cleanly set.
   
   Ideally we need a marker to set the root dir, we could use git as 
inspiration and force the presence of a `.mvn/.mvn_meta` which would be handled 
at "clone"/setup time somehow (do we fail if this file is missing, how do we 
ensure it is not committed and experience is smooth when a project is cloned?).
   
   The parent/child resolution + filtering to ensure the resolution does not 
use .m2/remote is still way more reliable IMHO since it always works to get a 
deterministic rootdir. Only case it is broken is when the child does not 
reference the parent but then the intent of the user was to be able to run 
either from the parent (rootdir=parent) or child only (rootdir=child) so we 
always exactly match the intent whereas with .mvn we have several counter 
examples since the presence is optional.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > > well the parent-child relation, and I often build setups where there are 
not really parent/child
   > 
   > as much as the `.mvn` thing actually, we are used to get it in the root 
dir but with fake parents (submodules for ex) it can be in the wrong dir so 
both strategies are as bad but relying on a recent addition and something not 
required by the project sounds very fragile upfront.
   
   I don't think it's broken, it's your use case which is wrong.  If you 
aggregate projects using submodules in a bigger aggregator, the definition of 
the `rootdir` indicates it won't bubble up, and that's definitely what we want, 
else the project build may fail locating files that are pointed to.  If we want 
a property that would point to the upper aggregator directory, we can define 
another property for that in a new PR, but I'm not sure about the use case for 
it yet, do you actually have one ?  Ffwiw, `git` has some similar properties to 
go up out of the gitmodule.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > I'm very confused by this PR, what I see:
   > 
   > 1. we had 2 dir properties and they are deprecated in favor of 2 dir 
properties, can't we fix the previous ones?
   
   My option was to not break anything, it was easier to define a new set of 
properties and deprecate the old ones rather than trying to find all spots 
where things could be impacted.
   
   > 2. the root dir is defined by the `.mvn` presence which is still not 
mainstream so will likely always fail instead of the top dir of linked project 
by the parent/child relationship defined by pom (which always works)
   
   Well, the current definition is closer to 
`maven.multiModuleProjectDirectory` which has been used for years, even if not 
really public.  The idea to rely on parent/child relationship just does not 
work imho : first, it would have to be computed after all projects are parsed, 
which conflicts with the fact that one of the use case it during project 
interpolation, or even very early during the command line interpolation.  
Although, there's absolutely no guarantee that it will point to the root level 
of the project, as I can point to lots of projects where this would not work. 
And the main use case imho it to locate files on the file system, so the 
parent/child relationship is completely unrelated and would not solve the 
issue.  It also have to never change for any build of the project, which would 
not be the case for any computation based on parent/child relationship.

   > So overall think the impl should be fixed (2) and we should probably 
collapse most of the properties we have, in particular for v4 where it will 
just be a clean up and avoid the redefinition of new props. The big pro of root 
dir is the ability to define absolutely a file config (style.xml is what i have 
in mind but there are multiple cases) so should absolutely be reliable for all 
projects, even without .mvn IMHO.
   
   It is at least very precisely defined and deterministic: you start from the 
`topdir` and go up until you find a `.mvn` tree.  If there's none, the property 
is not defined.  And it is fully compatible with all existing projects, that's 
the benefit of having new properties.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1489011010

   > well the parent-child relation, and I often build setups where there are 
not really parent/child
   
   as much as the `.mvn` thing actually, we are used to get it in the root dir 
but with fake parents (submodules for ex) it can be in the wrong dir so both 
strategies are as bad but relying on a recent addition and something not 
required by the project sounds very fragile upfront.
   
   The parent child relationship is pretty straight forward: resolve all the 
graph while child is linked to a parent and relativepath != null and parent is 
not resolved from .m2/remote. Then take the higher folder.
   It is as fragile as the .mvn but always works.
   It is fine for me to use the .mvn as a "stop bubbling" marker if present but 
if none is found parent/child relationship should be used IMHO.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

laeubi commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1488999749

   I only can add that I always have a `.mvn` dir in any setup, so "still not 
mainstream so will likely always fail " is probably depending on personal 
use-cases and experience.
   
   Also I like it very much as it is both very basic, and easy to understand 
and **always** works and is global across the build, where any parent/child 
relation depends on.. well the parent-child relation, and I often build setups 
where there are not really parent/child but only an aggregator pom what 
includes other modules that probably have another parent so there is now way 
for a global property, eg. aggregator include `project1` that has `parentA` and 
it includes `project2` that has `parentB`, while mabye at the same reactor or 
even not, so what should this "parent/child defined property" point to?




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1488942008

   I'm very confused by this PR, what I see:
   
   1. we had 2 dir properties and they are deprecated in favor of 2 dir 
properties, can't we fix the previous ones?
   2. the root dir is defined by the `.mvn` presence which is still not 
mainstream so will likely always fail instead of the top dir of linked project 
by the parent/child relationship defined by pom (which always works)
   
   So overall think the impl should be fixed (2) and we should probably 
collapse most of the properties we have, in particular for v4 where it will 
just be a clean up and avoid the redefinition of new props.
   The big pro of root dir is the ability to define absolutely a file config 
(style.xml is what i have in mind but there are multiple cases) so should 
absolutely be reliable for all projects, even without .mvn IMHO.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1152181028


##
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java:
##
@@ -165,7 +165,11 @@ public Object evaluate(String expr, Class type) throws 
ExpressionEvaluationEx
 
 MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
 
-if ("localRepository".equals(expression)) {
+if ("rootdir".equals(expression) || 
"session.rootdir".equals(expression)) {
+value = session.getRootdir();
+} else if ("topdir".equals(expression) || 
"session.topdir".equals(expression)) {
+value = session.getTopdir();

Review Comment:
   Very good, agreed.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1152107242


##
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java:
##
@@ -165,7 +165,11 @@ public Object evaluate(String expr, Class type) throws 
ExpressionEvaluationEx
 
 MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
 
-if ("localRepository".equals(expression)) {
+if ("rootdir".equals(expression) || 
"session.rootdir".equals(expression)) {
+value = session.getRootdir();
+} else if ("topdir".equals(expression) || 
"session.topdir".equals(expression)) {
+value = session.getTopdir();

Review Comment:
   > How does this then collide with `${project.basedir}`? The devs should be 
able to acces the current module project basedir. This should not change.
   
   Yes, I meant to deprecate `${basedir}` and favor `${project.basedir}`.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1152079980


##
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java:
##
@@ -165,7 +165,11 @@ public Object evaluate(String expr, Class type) throws 
ExpressionEvaluationEx
 
 MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
 
-if ("localRepository".equals(expression)) {
+if ("rootdir".equals(expression) || 
"session.rootdir".equals(expression)) {
+value = session.getRootdir();
+} else if ("topdir".equals(expression) || 
"session.topdir".equals(expression)) {
+value = session.getTopdir();

Review Comment:
   > That's true, if we don't support the non prefixed expression, we can 
simply use the code which follows and which should handle `session.rootdir` and 
`session.topdir` perfectly. Would you prefer that ?
   
   Yes, strive for consistency 





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1152077350


##
maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java:
##
@@ -1051,16 +1057,44 @@ public MavenExecutionRequest setToolchains(Map> too
 return this;
 }
 
+@Deprecated
 @Override
 public void setMultiModuleProjectDirectory(File directory) {
 this.multiModuleProjectDirectory = directory;
 }
 
+@Deprecated
 @Override
 public File getMultiModuleProjectDirectory() {
 return multiModuleProjectDirectory;
 }
 
+@Override
+public Path getRootdir() {
+if (rootdir == null) {
+throw new IllegalArgumentException("Unable to find the root 
directory. "

Review Comment:
   Accepted 





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1152028179


##
maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java:
##
@@ -133,6 +134,21 @@ public Object getValue(String expression) {
 valueSources.add(new 
BuildTimestampValueSource(config.getBuildStartTime(), modelProperties));
 }
 
+valueSources.add(new AbstractValueSource(false) {
+@Override
+public Object getValue(String expression) {
+if ("rootdir".equals(expression)) {
+Path path = config.getRootdir();
+if (path != null) {
+return path.toString();
+}
+throw new IllegalArgumentException("Unable to find the 
root directory. "

Review Comment:
   Agreed, I'll fix them all.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1152023745


##
maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java:
##
@@ -1051,16 +1057,44 @@ public MavenExecutionRequest setToolchains(Map> too
 return this;
 }
 
+@Deprecated
 @Override
 public void setMultiModuleProjectDirectory(File directory) {
 this.multiModuleProjectDirectory = directory;
 }
 
+@Deprecated
 @Override
 public File getMultiModuleProjectDirectory() {
 return multiModuleProjectDirectory;
 }
 
+@Override
+public Path getRootdir() {
+if (rootdir == null) {
+throw new IllegalArgumentException("Unable to find the root 
directory. "

Review Comment:
   But we can't know early if someone uses the `${session.rootdir}`or 
`${rootdir}` in the model, profile activation or a plugin configuration.  If we 
fail early, this will mean that all projects will be required to add this 
`.mvn` direction.  Note that we already have a warning if this directory does 
not exist.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1152023745


##
maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java:
##
@@ -1051,16 +1057,44 @@ public MavenExecutionRequest setToolchains(Map> too
 return this;
 }
 
+@Deprecated
 @Override
 public void setMultiModuleProjectDirectory(File directory) {
 this.multiModuleProjectDirectory = directory;
 }
 
+@Deprecated
 @Override
 public File getMultiModuleProjectDirectory() {
 return multiModuleProjectDirectory;
 }
 
+@Override
+public Path getRootdir() {
+if (rootdir == null) {
+throw new IllegalArgumentException("Unable to find the root 
directory. "

Review Comment:
   But we can't know early if someone uses the `${session.rootdir}`or 
`${rootdir}` in the model, profile activation or a plugin configuration.  If we 
fail early, this will mean that all projects will be required to add this 
`.mvn` direction, whether they actually use it or not.  Note that we already 
have a warning if this directory does not exist.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1152018222


##
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java:
##
@@ -165,7 +165,11 @@ public Object evaluate(String expr, Class type) throws 
ExpressionEvaluationEx
 
 MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
 
-if ("localRepository".equals(expression)) {
+if ("rootdir".equals(expression) || 
"session.rootdir".equals(expression)) {
+value = session.getRootdir();
+} else if ("topdir".equals(expression) || 
"session.topdir".equals(expression)) {
+value = session.getTopdir();

Review Comment:
   How does this then collide with `${project.basedir}`? The devs should be 
able to acces the current module project basedir. This should not change.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1152016383


##
maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java:
##
@@ -1051,16 +1057,44 @@ public MavenExecutionRequest setToolchains(Map> too
 return this;
 }
 
+@Deprecated
 @Override
 public void setMultiModuleProjectDirectory(File directory) {
 this.multiModuleProjectDirectory = directory;
 }
 
+@Deprecated
 @Override
 public File getMultiModuleProjectDirectory() {
 return multiModuleProjectDirectory;
 }
 
+@Override
+public Path getRootdir() {
+if (rootdir == null) {
+throw new IllegalArgumentException("Unable to find the root 
directory. "

Review Comment:
   But rather fail early than after 30 min of a build?





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1152000103


##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,50 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File getMultiModuleProjectDirectory();
 
+/**
+ * Sets the root dir of the project.
+ *
+ * @since 4.0.0
+ */
+MavenExecutionRequest setRootdir(Path rootdir);
+
+/**
+ * Gets the root directory of the project, which is the parent directory 
containing the {@code .mvn} directory.
+ * If there's no such file, an {@code IllegalArgumentException} will be 
thrown.
+ *
+ * @throws IllegalArgumentException if the root directory could not be 
found

Review Comment:
   Isn't this `IllegalStateException`?



##
maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java:
##
@@ -133,6 +134,21 @@ public Object getValue(String expression) {
 valueSources.add(new 
BuildTimestampValueSource(config.getBuildStartTime(), modelProperties));
 }
 
+valueSources.add(new AbstractValueSource(false) {
+@Override
+public Object getValue(String expression) {
+if ("rootdir".equals(expression)) {
+Path path = config.getRootdir();
+if (path != null) {
+return path.toString();
+}
+throw new IllegalArgumentException("Unable to find the 
root directory. "

Review Comment:
   ISE rather? The expression isn't invalid but the state within, no?



##
maven-model-builder/src/main/java/org/apache/maven/model/path/ProfileActivationFilePathInterpolator.java:
##
@@ -79,6 +80,25 @@ public Object getValue(String expression) {
 return null;
 }
 
+interpolator.addValueSource(new AbstractValueSource(false) {
+@Override
+public Object getValue(String expression) {
+/*
+ * We intentionally only support ${rootdir} and not 
${session.rootdir} as the latter form
+ * would suggest that other session.* expressions can be used 
which is beyond the design.
+ */
+if ("rootdir".equals(expression)) {
+Path path = context.getRootdir();
+if (path != null) {
+return path.toString();
+}
+throw new IllegalArgumentException("Unable to find the 
root directory. "

Review Comment:
   Same here



##
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##
@@ -321,6 +323,46 @@ void initialize(CliRequest cliRequest) throws 
ExitException {
 }
 }
 
+Path topdir = Paths.get(cliRequest.workingDirectory);
+boolean isAltFile = false;
+for (String arg : cliRequest.args) {
+if (isAltFile) {
+Path path = Paths.get(arg);
+if (Files.isDirectory(path)) {

Review Comment:
   Granted.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> The property requested should return /home/me/sources/multi-module, 
> regardless of whether it's 

[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1152011959


##
maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java:
##
@@ -1051,16 +1057,44 @@ public MavenExecutionRequest setToolchains(Map> too
 return this;
 }
 
+@Deprecated
 @Override
 public void setMultiModuleProjectDirectory(File directory) {
 this.multiModuleProjectDirectory = directory;
 }
 
+@Deprecated
 @Override
 public File getMultiModuleProjectDirectory() {
 return multiModuleProjectDirectory;
 }
 
+@Override
+public Path getRootdir() {
+if (rootdir == null) {
+throw new IllegalArgumentException("Unable to find the root 
directory. "

Review Comment:
   The goal is to throw an exception when actually used.  So it's not a hard 
requirement unless you actually use it somehow in a plugin or in a model, in 
which case, yes, it becomes a hard requirement.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1152003319


##
maven-model-builder/src/site/apt/index.apt:
##
@@ -192,6 +192,10 @@ Maven Model Builder
 *+--+--+
 | <<>> | The path to the current Maven home. | 
<<<$\{maven.home\}>>> |
 *+--+--+
+| <<>> | the directory containing the root <<>> file 
of a multi module project, in a single module project this is the same as 
<<>> | <<<$\{maven.rootdir\}>>> |
+*+--+--+
+| <<>> | the directory containing the top-level <<>> in 
this reactor build | <<<$\{maven.topdir\}>>> |
+*+--+--+

Review Comment:
   `topdir` is not really new, it's mostly a rename of the `executionRootDir` 
property to make it more coherent with `basedir` and `rootdir`, else we end up 
with `root directory` and `execution root directory` for different things, and 
that will definitely lead to problems imho.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1151997995


##
maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java:
##
@@ -1051,16 +1057,44 @@ public MavenExecutionRequest setToolchains(Map> too
 return this;
 }
 
+@Deprecated
 @Override
 public void setMultiModuleProjectDirectory(File directory) {
 this.multiModuleProjectDirectory = directory;
 }
 
+@Deprecated
 @Override
 public File getMultiModuleProjectDirectory() {
 return multiModuleProjectDirectory;
 }
 
+@Override
+public Path getRootdir() {
+if (rootdir == null) {
+throw new IllegalArgumentException("Unable to find the root 
directory. "

Review Comment:
   This needs to be documented since it looks like a hard requirement now.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1151777611


##
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java:
##
@@ -165,7 +165,11 @@ public Object evaluate(String expr, Class type) throws 
ExpressionEvaluationEx
 
 MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
 
-if ("localRepository".equals(expression)) {
+if ("rootdir".equals(expression) || 
"session.rootdir".equals(expression)) {
+value = session.getRootdir();
+} else if ("topdir".equals(expression) || 
"session.topdir".equals(expression)) {
+value = session.getTopdir();

Review Comment:
   @michael-o  fwiw, the addition of `rootdir` and `topdir` was done to be in 
line with `basedir`, so maybe we should deprecate that one ?  I'll raise a PR 
to clean at least the v4 expression evaluator, as plugins will have to migrate 
to switch to it anyway.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1151777611


##
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java:
##
@@ -165,7 +165,11 @@ public Object evaluate(String expr, Class type) throws 
ExpressionEvaluationEx
 
 MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
 
-if ("localRepository".equals(expression)) {
+if ("rootdir".equals(expression) || 
"session.rootdir".equals(expression)) {
+value = session.getRootdir();
+} else if ("topdir".equals(expression) || 
"session.topdir".equals(expression)) {
+value = session.getTopdir();

Review Comment:
   @michael-o  fwiw, the addition of `rootdir` and `topdir` was done to be in 
line with `basedir`, so maybe we should deprecate that one ? 





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1151708471


##
api/maven-api-core/src/main/java/org/apache/maven/api/Project.java:
##
@@ -86,8 +86,34 @@ default String getId() {
 return getModel().getId();
 }
 
+/**
+ * @deprecated use {@link #isTopdirProject()} instead
+ */
+@Deprecated
 boolean isExecutionRoot();
 
+/**
+ * Returns a boolean indicating if the project is the top leve project for
+ * this reactor build.  The top level project may be different from the
+ * {@code rootDirProject}, especially if a subtree of the project is being
+ * built, either because maven has been launched in a subdirectory or using
+ * a {@code -f} option.
+ *
+ * @return {@code true} if the project is the top level project for this 
build
+ */
+boolean isTopdirProject();

Review Comment:
   That makes sense





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1151706480


##
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java:
##
@@ -165,7 +165,11 @@ public Object evaluate(String expr, Class type) throws 
ExpressionEvaluationEx
 
 MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
 
-if ("localRepository".equals(expression)) {
+if ("rootdir".equals(expression) || 
"session.rootdir".equals(expression)) {
+value = session.getRootdir();
+} else if ("topdir".equals(expression) || 
"session.topdir".equals(expression)) {
+value = session.getTopdir();

Review Comment:
   That's true, if we don't support the non prefixed expression, we can simply 
use the code which follows and which should handle `session.rootdir` and 
`session.topdir` perfectly.  Would you prefer that ?





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1151704300


##
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##
@@ -321,6 +323,46 @@ void initialize(CliRequest cliRequest) throws 
ExitException {
 }
 }
 
+Path topdir = Paths.get(cliRequest.workingDirectory);
+boolean isAltFile = false;
+for (String arg : cliRequest.args) {
+if (isAltFile) {
+Path path = Paths.get(arg);
+if (Files.isDirectory(path)) {

Review Comment:
   The `commandLine` variable is initialised in a following step.  Also, if we 
want to allow some interpolation in the command line arguments, we definitely 
need to compute this variable early.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-29 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1151702341


##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,49 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File getMultiModuleProjectDirectory();
 
+/**
+ * Sets the root dir of the project.
+ *
+ * @since 4.0.0
+ */
+MavenExecutionRequest setRootdir(Path rootdir);
+
+/**
+ * Gets the root dir of the project, which is the up-most directory of the 
reactor, usually containing
+ * the {@code .mvn} directory.
+ *
+ * @since 4.0.0
+ */
+Path getRootdir();

Review Comment:
   If there's no `.mvn` directory, the value currently defaults to `topdir`, 
i.e. the current directory or the one pointed to with the `-f`/`--file` option. 
   @cstamas we could change the behaviour to: print a warning, default to 
`null`, throw an exception when accessed using a getter (i.e. from plugins, or 
when injected / interpolated).  Is that what you have in mind ?





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-27 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1149298654


##
maven-model-builder/src/site/apt/index.apt:
##
@@ -192,6 +192,10 @@ Maven Model Builder
 *+--+--+
 | <<>> | The path to the current Maven home. | 
<<<$\{maven.home\}>>> |
 *+--+--+
+| <<>> | the directory containing the root <<>> file 
of a multi module project, in a single module project this is the same as 
<<>> | <<<$\{maven.rootdir\}>>> |
+*+--+--+
+| <<>> | the directory containing the top-level <<>> in 
this reactor build | <<<$\{maven.topdir\}>>> |
+*+--+--+

Review Comment:
   what's the point of topdir then? it does not have to match cwd nor the 
rootdir so sounds like a randomdir at usage





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-27 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

cstamas commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1149257791


##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,49 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File getMultiModuleProjectDirectory();
 
+/**
+ * Sets the root dir of the project.
+ *
+ * @since 4.0.0
+ */
+MavenExecutionRequest setRootdir(Path rootdir);
+
+/**
+ * Gets the root dir of the project, which is the up-most directory of the 
reactor, usually containing
+ * the {@code .mvn} directory.
+ *
+ * @since 4.0.0
+ */
+Path getRootdir();

Review Comment:
   This getter may fail (lazily) if invoked by there is no `.mvn` directory 
present (the value cannot be calculated)?



##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,49 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File getMultiModuleProjectDirectory();
 
+/**
+ * Sets the root dir of the project.
+ *
+ * @since 4.0.0
+ */
+MavenExecutionRequest setRootdir(Path rootdir);
+
+/**
+ * Gets the root dir of the project, which is the up-most directory of the 
reactor, usually containing
+ * the {@code .mvn} directory.
+ *
+ * @since 4.0.0
+ */
+Path getRootdir();

Review Comment:
   This getter may fail (lazily) if invoked by there is no `.mvn` directory 
present (the value cannot be calculated)?





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-23 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

w6et commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1481644481

   > JIRA issue: [[MNG-7038](https://issues.apache.org/jira/browse/MNG-7038)] 
Introduce public property to point to a root directory of (multi-module) project
   > 
   > This PR introduces two properties:
   > 
   > * `session.topdir` / `topdir` : _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 `topdir` is similar to the 
`executionRootDirectory` property available on the session, but renamed to make 
it coherent with the new `rootdir` and to avoid using _root_ in its name.  The 
`topdir` 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.rootdir` / `rootdir` : _the parent directory containing a 
`.mvn` subdirectory, usually the directory containing the topmost `pom.xml` of 
the project_.  The `rootdir` property is roughly the same as the 
`${maven.multiModuleProjectDirectory}`, but computed by the CLI.  If the 
`rootdir` can not be properly determined (usually because there's no `.mvn` 
directory), a warning will be printed to the console.
   > 
   > The `topdir` and `rootdir` properties are made available on the 
`MavenSession` / `Session` and deprecate the `executionRootDirectory` and 
`multiModuleProjectDirectory` properties. The `rootdir` should never change for 
a given project and is thus made available for profile activation and model 
interpolation. The goal is also to make it available as a system property 
during [command line arguments 
interpolation](https://github.com/apache/maven/pull/1062).
   
   i think we can define a build.yml\json, generate build-lock.yml\json at 
lifecycle process-resources,in build.yml,can load properties file,can define 
any public properties with expression(value from sys/user env  properties or 
properties file)




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-23 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1481340183

   I think also in general a new page in `maven-site` would be required 
depicting multiple use cases how both values might differ, e.e., `tree(1)` 
style.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-23 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1146267900


##
api/maven-api-core/src/main/java/org/apache/maven/api/Project.java:
##
@@ -86,8 +86,34 @@ default String getId() {
 return getModel().getId();
 }
 
+/**
+ * @deprecated use {@link #isTopdirProject()} instead
+ */
+@Deprecated
 boolean isExecutionRoot();
 
+/**
+ * Returns a boolean indicating if the project is the top leve project for
+ * this reactor build.  The top level project may be different from the
+ * {@code rootDirProject}, especially if a subtree of the project is being
+ * built, either because maven has been launched in a subdirectory or using
+ * a {@code -f} option.
+ *
+ * @return {@code true} if the project is the top level project for this 
build
+ */
+boolean isTopdirProject();
+
+/**
+ * Returns a boolean indicating if the project is the project from the root
+ * directory of this reactor. The root project is the top-most project 
containing
+ * the {@code .mvn} directory.  If only a subtree of the reactor is build 
(because
+ * the current directory is in a subtree or because the {@code -f} option 
has been
+ * specified, then there may be no rootDirProject in this reactor.
+ *
+ * @return {@code true} if the project is the root dir project
+ */
+boolean isRootdirProject();

Review Comment:
   Same here



##
api/maven-api-core/src/main/java/org/apache/maven/api/Project.java:
##
@@ -86,8 +86,34 @@ default String getId() {
 return getModel().getId();
 }
 
+/**
+ * @deprecated use {@link #isTopdirProject()} instead
+ */
+@Deprecated
 boolean isExecutionRoot();
 
+/**
+ * Returns a boolean indicating if the project is the top leve project for
+ * this reactor build.  The top level project may be different from the
+ * {@code rootDirProject}, especially if a subtree of the project is being
+ * built, either because maven has been launched in a subdirectory or using
+ * a {@code -f} option.
+ *
+ * @return {@code true} if the project is the top level project for this 
build
+ */
+boolean isTopdirProject();

Review Comment:
   Why not `isTopProject()` or `isTopLevelProject()`?



##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,49 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File getMultiModuleProjectDirectory();
 
+/**
+ * Sets the root dir of the project.
+ *
+ * @since 4.0.0
+ */
+MavenExecutionRequest setRootdir(Path rootdir);
+
+/**
+ * Gets the root dir of the project, which is the up-most directory of the 
reactor, usually containing

Review Comment:
   Here you use the term "up-most" which is likely better



##
api/maven-api-core/src/main/java/org/apache/maven/api/Project.java:
##
@@ -86,8 +86,34 @@ default String getId() {
 return getModel().getId();
 }
 
+/**
+ * @deprecated use {@link #isTopdirProject()} instead
+ */
+@Deprecated
 boolean isExecutionRoot();
 
+/**
+ * Returns a boolean indicating if the project is the top leve project for

Review Comment:
   level



##
api/maven-api-core/src/main/java/org/apache/maven/api/Project.java:
##
@@ -86,8 +86,34 @@ default String getId() {
 return getModel().getId();
 }
 
+/**
+ * @deprecated use {@link #isTopdirProject()} instead
+ */
+@Deprecated
 boolean isExecutionRoot();
 
+/**
+ * Returns a boolean indicating if the project is the top leve project for
+ * this reactor build.  The top level project may be different from the
+ * {@code rootDirProject}, especially if a subtree of the project is being
+ * built, either because maven has been launched in a subdirectory or using

Review Comment:
   Maven



##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -494,14 +504,49 @@ public interface MavenExecutionRequest {
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #setRootdir(Path)} instead
  */
+@Deprecated
 void setMultiModuleProjectDirectory(File file);
 
 /**
  * @since 3.3.0
+ * @deprecated use {@link #getRootdir()} instead
  */
+@Deprecated
 File 

[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1142256086


##
maven-model-builder/src/site/apt/index.apt:
##
@@ -192,6 +192,10 @@ Maven Model Builder
 *+--+--+
 | <<>> | The path to the current Maven home. | 
<<<$\{maven.home\}>>> |
 *+--+--+
+| <<>> | the directory containing the root <<>> file 
of a multi module project, in a single module project this is the same as 
<<>> | <<<$\{maven.rootdir\}>>> |
+*+--+--+
+| <<>> | the directory containing the top-level <<>> in 
this reactor build | <<<$\{maven.topdir\}>>> |
+*+--+--+

Review Comment:
   > ? `topdir` should be available in interpolation, it is its main usage to 
reference absolutely configurations otherwise not sure its interest for end 
users.
   
   No, that's would be the `rootdir`.  The `topdir` would be defined as the the 
top-most directory of executed projects in the reactor (basically, the current 
directory or the one pointed to when using `-f`/`--file`).





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1142241800


##
maven-model-builder/src/site/apt/index.apt:
##
@@ -192,6 +192,10 @@ Maven Model Builder
 *+--+--+
 | <<>> | The path to the current Maven home. | 
<<<$\{maven.home\}>>> |
 *+--+--+
+| <<>> | the directory containing the root <<>> file 
of a multi module project, in a single module project this is the same as 
<<>> | <<<$\{maven.rootdir\}>>> |
+*+--+--+
+| <<>> | the directory containing the top-level <<>> in 
this reactor build | <<<$\{maven.topdir\}>>> |
+*+--+--+

Review Comment:
   ? `topdir` should be available in interpolation, it is its main usage to 
reference absolutely configurations otherwise not sure its interest for end 
users.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1142137049


##
maven-model-builder/src/site/apt/index.apt:
##
@@ -192,6 +192,10 @@ Maven Model Builder
 *+--+--+
 | <<>> | The path to the current Maven home. | 
<<<$\{maven.home\}>>> |
 *+--+--+
+| <<>> | the directory containing the root <<>> file 
of a multi module project, in a single module project this is the same as 
<<>> | <<<$\{maven.rootdir\}>>> |
+*+--+--+
+| <<>> | the directory containing the top-level <<>> in 
this reactor build | <<<$\{maven.topdir\}>>> |
+*+--+--+

Review Comment:
   Actually, `topdir` should not be part of any model interpolation, because 
it's mainly the current directory and should definitely not have any effect.  
This will require an additional parameter to `ModelInterpolator.interpolate()`  
or to add it to the `ModelBuildingRequest`. 
   
   However, `rootdir` should be part of profile activation along `basedir` imho.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1142090120


##
maven-model-builder/src/site/apt/index.apt:
##
@@ -192,6 +192,10 @@ Maven Model Builder
 *+--+--+
 | <<>> | The path to the current Maven home. | 
<<<$\{maven.home\}>>> |
 *+--+--+
+| <<>> | the directory containing the root <<>> file 
of a multi module project, in a single module project this is the same as 
<<>> | <<<$\{maven.rootdir\}>>> |
+*+--+--+
+| <<>> | the directory containing the top-level <<>> in 
this reactor build | <<<$\{maven.topdir\}>>> |
+*+--+--+

Review Comment:
   I agree, I'll remove all references to `maven.rootdir` and `maven.topdir`.  
It makes sense to keep `session.rootdir` and `session.topdir` because they are 
available from those objects.
   I'd rather [set them as `session.rootdir` and `session.topdir` in the 
request system 
properties](https://github.com/apache/maven/pull/1061/files#diff-b8b814f5b6b3855ae79dc45a0266b94871193dcef42803c316e07409e94af35cR612-R617).
  That would allow using them in the context of [arguments interpolation / 
`MNG-6303`](https://github.com/apache/maven/pull/1062). 





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1142096044


##
maven-model-builder/src/site/apt/index.apt:
##
@@ -192,6 +192,10 @@ Maven Model Builder
 *+--+--+
 | <<>> | The path to the current Maven home. | 
<<<$\{maven.home\}>>> |
 *+--+--+
+| <<>> | the directory containing the root <<>> file 
of a multi module project, in a single module project this is the same as 
<<>> | <<<$\{maven.rootdir\}>>> |
+*+--+--+
+| <<>> | the directory containing the top-level <<>> in 
this reactor build | <<<$\{maven.topdir\}>>> |
+*+--+--+

Review Comment:
   Make sense, but for that case maybe they should be added manually to the 
interpolation instead of going through system properties route?





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1142092067


##
maven-core/src/main/java/org/apache/maven/execution/MavenSession.java:
##
@@ -141,10 +142,28 @@ public List getProjects() {
 return projects;
 }
 
+/**
+ * @deprecated use {@link #getTopdir()}
+ */
+@Deprecated
 public String getExecutionRootDirectory() {
 return request.getBaseDirectory();
 }
 
+/**
+ * @since 4.0
+ */
+public Path getTopdir() {
+return request.getTopdir();
+}
+
+/**
+ * @since 4.0

Review Comment:
   Note that all the new classes from the api are annotated with `4.0`, so I 
guess I'll raise a PR to fix those and make things a bit more coherent.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

gnodet commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1142090120


##
maven-model-builder/src/site/apt/index.apt:
##
@@ -192,6 +192,10 @@ Maven Model Builder
 *+--+--+
 | <<>> | The path to the current Maven home. | 
<<<$\{maven.home\}>>> |
 *+--+--+
+| <<>> | the directory containing the root <<>> file 
of a multi module project, in a single module project this is the same as 
<<>> | <<<$\{maven.rootdir\}>>> |
+*+--+--+
+| <<>> | the directory containing the top-level <<>> in 
this reactor build | <<<$\{maven.topdir\}>>> |
+*+--+--+

Review Comment:
   I agree, I'll remove all references to `maven.rootdir` and `maven.topdir`.  
It makes sense to keep `session.rootdir` and `session.topdir` because they are 
available from those objects.
   I'd rather set them as `session.rootdir` and `session.topdir` in the request 
system properties.  That would allow using them in the context of [arguments 
interpolation / `MNG-6303`](https://github.com/apache/maven/pull/1062).





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on code in PR #1061:
URL: https://github.com/apache/maven/pull/1061#discussion_r1142073069


##
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java:
##
@@ -91,8 +92,17 @@ public interface MavenExecutionRequest {
 // --
 
 // Base directory
+
+/**
+ * @deprecated use {@link #getTopdir()} instead

Review Comment:
   Looks wrong? Should point to the setter.



##
maven-core/src/main/java/org/apache/maven/execution/MavenSession.java:
##
@@ -141,10 +142,28 @@ public List getProjects() {
 return projects;
 }
 
+/**
+ * @deprecated use {@link #getTopdir()}
+ */
+@Deprecated
 public String getExecutionRootDirectory() {
 return request.getBaseDirectory();
 }
 
+/**
+ * @since 4.0
+ */
+public Path getTopdir() {
+return request.getTopdir();
+}
+
+/**
+ * @since 4.0

Review Comment:
   4.0.0



##
maven-core/src/main/java/org/apache/maven/execution/MavenSession.java:
##
@@ -141,10 +142,28 @@ public List getProjects() {
 return projects;
 }
 
+/**
+ * @deprecated use {@link #getTopdir()}
+ */
+@Deprecated
 public String getExecutionRootDirectory() {
 return request.getBaseDirectory();
 }
 
+/**
+ * @since 4.0

Review Comment:
   4.0.0



##
maven-model-builder/src/site/apt/index.apt:
##
@@ -192,6 +192,10 @@ Maven Model Builder
 *+--+--+
 | <<>> | The path to the current Maven home. | 
<<<$\{maven.home\}>>> |
 *+--+--+
+| <<>> | the directory containing the root <<>> file 
of a multi module project, in a single module project this is the same as 
<<>> | <<<$\{maven.rootdir\}>>> |
+*+--+--+
+| <<>> | the directory containing the top-level <<>> in 
this reactor build | <<<$\{maven.topdir\}>>> |
+*+--+--+

Review Comment:
   I believe that these properties should not propagate into system properties 
permanently, but should be private `_maven.` because `maven.` refers to the 
Maven installation here, everything else is `project.` or `session.`. Let's not 
repeat that mistake.





> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread Michael Osipov (Jira)


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

Michael Osipov commented on MNG-7038:
-

This was more or less my idea while the ini is jvm.config. Don't want to 
reinvent the wheel. Would solve a lot of problems. 

> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread Jira


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

Christoph Läubrich commented on MNG-7038:
-

> I have been thinking for years to write a C based launcher for Maven similar 
> to Eclipse, but never found the time. 

You probably can use the eclipse one, it just calls a main method and reads the 
jvm args from the eclipse.ini so probably it can be adjusted / stripped down 
quite easy.

> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

michael-o commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1475958019

   > @gnodet right but it has the network stack which makes the binary "fat" 
compared to a vanilla main compiled with graalvm but let's put graal aside and 
agree on the fact we need a light (not java sadly) launcher to run properly and 
portably maven. Then topdir feature comes into this module and is well defined 
compared to all alternatives we have which are all partial.
   
   I have been thinking for years to write a C based launcher for Maven similar 
to Eclipse, but never found the time. 




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1475944821

   @gnodet right but it has the network stack which makes the binary "fat" 
compared to a vanilla main compiled with graalvm but let's put graal aside and 
agree on the fact we need a light (not java sadly) launcher to run properly and 
portably maven. Then topdir feature comes into this module and is well defined 
compared to all alternatives we have which are all partial.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread Jira


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

Christoph Läubrich commented on MNG-7038:
-

I'm not sure why a launcher now has dripped in here, but to summarize:
- there is already a property working for years but not documented anywhere, 
and it is even accessible from the maven model
- now it was asked to make this "official" because user find it useful

No one asked for more properties, or better properties or launchers or 
jvm.config ;-)

So at the moment the only problem is that if there is no .mvn folder, the 
property is undefined, something that can simply be documented and then its all 
fine I think, one could think about a new name but even that seems a bit 
over-engineered.

> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > > That looks like mvnd but without keeping daemons alive...
   > 
   > Not really since mvnd is a full mvn process whereas here it would just be 
a launcher responsible to handle the actual java command line to respect 
properly jvm.config. 
   
   That's a wrong assumption.  Mvnd has a client which boots a JVM (the daemon) 
and which is compiled to native with graalvm.  The client does not load maven.
   
   
   




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1475905867

   > That looks like mvnd but without keeping daemons alive...
   
   Not really since mvnd is a full mvn process whereas here it would just be a 
launcher responsible to handle the actual java command line to respect properly 
jvm.config. Agree the resolution can bring some resolver deps but shouldn't be 
as complete as mvnd.
   
   Even if I agree with the overall statement, anything in between looks wrong 
to me since it means topdir will not be usable until you have a .mvn (which is 
not the most common thing), we'll keep broken properties for this very common 
need and we keep a broken jvm.config so from my window everything converges to 
get a launcher to maven if we want these features.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > > Fwiw, that will mean that the computation needs to be duplicated 
somehow, so that the maven launch script can locate the .mvn/jvm.config file 
and read it before starting the JVM...
   > 
   > Well, we still have issues with `jvm.config` (spaces, quotes, EOL, ...) in 
terms of parsing so wonder if we shouldn't revisit it anyway. I had in mind a 
small native binary (either using graalvm without http and all the options 
making it fat or whatever is fast to launch) which could handle it to actually 
fork (unix)/trigger the real execution but, IMHO, it must belong to maven and 
not any enclosing tooling otherwise it is not part of maven and lost easily in 
any integration which must mimic our fragile script.
   
   That looks like `mvnd` but without keeping daemons alive...




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1475396223

   > Fwiw, that will mean that the computation needs to be duplicated somehow, 
so that the maven launch script can locate the .mvn/jvm.config file and read it 
before starting the JVM...
   
   Well, we still have issues with `jvm.config` (spaces, quotes, EOL, ...) in 
terms of parsing so wonder if we shouldn't revisit it anyway. I had in mind a 
small native binary (either using graalvm without http and all the options 
making it fat or whatever is fast to launch) which could handle it to actually 
fork (unix)/trigger the real execution but, IMHO, it must belong to maven and 
not any enclosing tooling otherwise it is not part of maven and lost easily in 
any integration which must mimic our fragile script.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > I'd be to make it public but also not controlled by scripts to always be 
accurate.
   
   Fwiw, that will mean that the computation needs to be duplicated somehow, so 
that the maven launch script can locate the `.mvn/jvm.config` file and read it 
before starting the JVM...




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-18 Thread Jira


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

Christoph Läubrich commented on MNG-7038:
-

> Having a `.mvn` directory gives a clear and simple definition and computation.

I agree with that, if it is documented that if one wants to use the property it 
would be fine I think and as it already *is* defined to work that way 
(mven.config, jvm.config, extensions.xml) the only "missing link" is making it 
official how to use it, and that's what this is about, I don't really see why 
we now need a whole set of things name them in different ways and have complex 
definitions.
Its also quite easy to just create an empty folder if one just likes to get it 
defined.

> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-18 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > I'd be to make it public but also not controlled by scripts to always be 
accurate.
   
   I have no problem with that.The point is to have a proper definition and 
thus computation for it.  Having a `.mvn` directory gives a clear and simple 
definition and computation. Not having it may lead to go outside the source 
tree (if the project is part of a bigger project) or unable to be detected (in 
which case the `multiModuleProjectDirectory` defaults to the current dir).




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-18 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1475037729

   I'd be to make it public but also not controlled by scripts to always be 
accurate.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-18 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > @gnodet guess worse case we can do 2 passes since parent/child 
relationship does not support interpolation properly anyway by design. Point is 
that the .mvn requirement is high for a so often needed prop so 1. I'd live to 
not have it (technically it is cleaner too even if .mvn does not prevent to 
"stop bubbling") and 2. if kept like that it must be named mvn.mvn.rootdir and 
be made it obvious it must not be used in parent poms, boms and plugins 
probably (indeed i hope we avoid that since tech we dont need .mvn presence in 
99% of the cases).
   
   The goal is to make have a  public property that can be used, not to hide 
it.  We already have the hidden `multiModuleProjectDirectory` which is hidden.  
 What's the point of having it hidden ?




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-18 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

rmannibucau commented on PR #1061:
URL: https://github.com/apache/maven/pull/1061#issuecomment-1474981343

   @gnodet guess worse case we can do 2 passes since parent/child relationship 
does not support interpolation properly anyway by design. Point is that the 
.mvn requirement is high for a so often needed prop so 1. I'd live to not have 
it (technically it is cleaner too even if .mvn does not prevent to "stop 
bubbling") and 2. if kept like that it must be named mvn.mvn.rootdir and be 
made it obvious it must not be used in parent poms, boms and plugins probably 
(indeed i hope we avoid that since tech we dont need .mvn presence in 99% of 
the cases).




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


[jira] [Commented] (MNG-7038) Introduce public property to point to a root directory of (multi-module) project

2023-03-18 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on MNG-7038:
-

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

   > @gnodet sharing the use case, just adding that rootdir must not require 
.mvn dir presence as a marker so must use the pom hierarchy and take the 
highest parent, was just detailling a bit the impl idea.
   
   I think that would require another property,  I'm all for defining 
additional properties. But a property based on parent/child relationship would 
be made available after projects are built, so it would not be able to be used 
during interpolation imho.




> 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: 
> {{}}
>  {{    }}
>  {{        com.acme}}
>  {{        corp-parent}}
>  {{        1.0.0-RELEASE}}
>  {{    }}
>  {{    com.acme}}
>  {{        multi-module}}
>  {{        0.5.2-SNAPSHOT}}
>  {{    }}
>  {{        module-a}}
>  {{        module-b}}
>  {{    }}
>  {{}}
> 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)


  1   2   >