[GitHub] [maven] michael-o commented on a diff in pull request #1062: [MNG-6303] Interpolate user supplied properties and command line arguments

2023-05-05 Thread via GitHub


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


##
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##
@@ -31,16 +31,8 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;

Review Comment:
   OK, if spotless does not complain, I won't either, but that's not the usual 
approach for our code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] michael-o commented on a diff in pull request #1062: [MNG-6303] Interpolate user supplied properties and command line arguments

2023-05-05 Thread via GitHub


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


##
maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java:
##
@@ -552,6 +553,38 @@ public void findRootProjectWithAttribute() {
 assertEquals(test, new 
DefaultRootLocator().findRoot(test.resolve("child")));
 }
 
+@Test
+public void testPropertiesInterpolation() throws Exception {
+// Arrange
+CliRequest request = new CliRequest(
+new String[] {
+"-Dfoo=bar",
+"-DvalFound=s${foo}i",
+"-DvalNotFound=s${foz}i",
+"-DvalRootDirectory=${session.rootDirectory}/.mvn/foo",
+"-DvalTopDirectory=${session.topDirectory}/pom.xml",
+"-f",
+"${session.rootDirectory}/my-child",
+"prefix:3.0.0:${foo}",
+"validate"

Review Comment:
   I mean `foo`. You cannot foo before it has been defined, just like symbols 
in C. It does not perform a late eval. So is the following possible?
   
   ```
   -Dbla=${foo}
   -Dfoo=blubb
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] michael-o commented on a diff in pull request #1062: [MNG-6303] Interpolate user supplied properties and command line arguments

2023-05-05 Thread via GitHub


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


##
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##
@@ -31,16 +31,8 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;

Review Comment:
   Do we really want blanket import?



##
maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java:
##
@@ -552,6 +553,38 @@ public void findRootProjectWithAttribute() {
 assertEquals(test, new 
DefaultRootLocator().findRoot(test.resolve("child")));
 }
 
+@Test
+public void testPropertiesInterpolation() throws Exception {
+// Arrange
+CliRequest request = new CliRequest(
+new String[] {
+"-Dfoo=bar",
+"-DvalFound=s${foo}i",
+"-DvalNotFound=s${foz}i",
+"-DvalRootDirectory=${session.rootDirectory}/.mvn/foo",
+"-DvalTopDirectory=${session.topDirectory}/pom.xml",
+"-f",
+"${session.rootDirectory}/my-child",
+"prefix:3.0.0:${foo}",
+"validate"

Review Comment:
   As far as I understand, they need to be defined ahead of time, right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] michael-o commented on a diff in pull request #1062: [MNG-6303] Interpolate user supplied properties and command line arguments

2023-04-15 Thread via GitHub


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


##
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);

Review Comment:
   Then we need to review everything in Core and make it consistent.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] michael-o commented on a diff in pull request #1062: [MNG-6303] Interpolate user supplied properties and command line arguments

2023-04-15 Thread via GitHub


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


##
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);

Review Comment:
   That is everywhere the case and the properties end with `dir` as well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org