timoninmaxim commented on code in PR #11603:
URL: https://github.com/apache/ignite/pull/11603#discussion_r1806443101


##########
modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/MavenUtils.java:
##########
@@ -263,6 +263,19 @@ private static Path resolveMavenSettingsFilePath() {
 
     /** */
     private static String resolveMavenApplicationPath() {
+
+        File currentDir = new File(System.getProperty("user.dir"));
+
+        while (currentDir != null && !new File(currentDir, "mvnw").exists()) {
+            currentDir = currentDir.getParentFile();
+        }
+
+        Path mvnwPath = Paths.get(currentDir.getAbsolutePath(), "mvnw");
+
+        if (Files.exists(mvnwPath) && Files.isExecutable(mvnwPath)) {
+            return mvnwPath.toString();
+        }
+
         String m2Home = System.getenv("M2_HOME");

Review Comment:
   Explicit M2_HOME is more preferable place to finding the script



##########
modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/MavenUtils.java:
##########
@@ -263,6 +263,19 @@ private static Path resolveMavenSettingsFilePath() {
 
     /** */
     private static String resolveMavenApplicationPath() {
+
+        File currentDir = new File(System.getProperty("user.dir"));
+
+        while (currentDir != null && !new File(currentDir, "mvnw").exists()) {
+            currentDir = currentDir.getParentFile();
+        }
+
+        Path mvnwPath = Paths.get(currentDir.getAbsolutePath(), "mvnw");

Review Comment:
   code duplication, you already create a File object with `mvnw` subpath



##########
modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/MavenUtils.java:
##########
@@ -263,6 +263,19 @@ private static Path resolveMavenSettingsFilePath() {
 
     /** */
     private static String resolveMavenApplicationPath() {
+

Review Comment:
   Remove blank line



##########
modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/util/MavenUtils.java:
##########
@@ -263,6 +263,19 @@ private static Path resolveMavenSettingsFilePath() {
 
     /** */
     private static String resolveMavenApplicationPath() {
+
+        File currentDir = new File(System.getProperty("user.dir"));
+
+        while (currentDir != null && !new File(currentDir, "mvnw").exists()) {
+            currentDir = currentDir.getParentFile();
+        }
+
+        Path mvnwPath = Paths.get(currentDir.getAbsolutePath(), "mvnw");
+
+        if (Files.exists(mvnwPath) && Files.isExecutable(mvnwPath)) {

Review Comment:
   You use 2 ways to check that file exists - in L269 `File#exists()` in this 
line `Files.exists()`. 



-- 
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: notifications-unsubscr...@ignite.apache.org

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

Reply via email to