You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "slawekjaranowski (via GitHub)" <gi...@apache.org> on 2023/05/02 09:47:19 UTC

[GitHub] [maven] slawekjaranowski commented on a diff in pull request #1097: [MNG-7774] Maven config and command line interpolation

slawekjaranowski commented on code in PR #1097:
URL: https://github.com/apache/maven/pull/1097#discussion_r1182332073


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -301,11 +307,17 @@ void initialize(CliRequest cliRequest) throws ExitException {
                 System.err.format("-D%s system property is not set.", MULTIMODULE_PROJECT_DIRECTORY);
                 throw new ExitException(1);
             }
-            File basedir = basedirProperty != null ? new File(basedirProperty) : new File("");
-            try {
-                cliRequest.multiModuleProjectDirectory = basedir.getCanonicalFile();
-            } catch (IOException e) {
-                cliRequest.multiModuleProjectDirectory = basedir.getAbsoluteFile();
+            File basedir = new File(basedirProperty);
+            if (new File(basedir, DOT_MVN).isDirectory()) {
+                try {
+                    cliRequest.multiModuleProjectDirectory = basedir.getCanonicalFile();
+                } catch (IOException e) {
+                    cliRequest.multiModuleProjectDirectory = basedir.getAbsoluteFile();
+                }
+            }
+        } else {
+            if (!isMultiModuleProjectDirectoryAcceptable(cliRequest.multiModuleProjectDirectory)) {
+                cliRequest.multiModuleProjectDirectory = null;

Review Comment:
   Will be ok that multiModuleProjectDirectory will be null.?
   What other impact it can have?



-- 
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-unsubscribe@maven.apache.org

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