You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2023/05/02 09:48:00 UTC

[jira] [Commented] (MNG-7774) Maven config and command line interpolation

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

ASF GitHub Bot commented on MNG-7774:
-------------------------------------

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?





> Maven config and command line interpolation
> -------------------------------------------
>
>                 Key: MNG-7774
>                 URL: https://issues.apache.org/jira/browse/MNG-7774
>             Project: Maven
>          Issue Type: Task
>          Components: Command Line
>            Reporter: Tamas Cservenak
>            Assignee: Tamas Cservenak
>            Priority: Major
>             Fix For: 3.9.2
>
>
> Note: this issue "mildly follows" functionality done in Maven 4 as part of MNG-7038 and MNG-6303, with partial implementation only (is not full back-port), hence "mild introduction".
> Rationale: many new resolver features are akin to be able to store their configuration and input along SCM tracked Maven project sources. Sadly, currently this is not possible. The two issues targeting Maven4 (MNG-7038 and MNG-6303) with introduction of session and project "topDirectory" and "rootDirectory" properties solve this. Still, Maven 3.9.x does not need all of this.
> So, idea is following:
>  * extend MavenCli to interpolate Maven arguments
>  * introduce two special properties {{session.rootDirectory}} and {{session.topDirectory}} in interpolation. They are special, as they may not be defined, and IF they are not defined, their use in Maven argument interpolation causes error (Maven will not boot).
>  * limit the use of the two new properties to Maven CLI interpolation only. This makes projects relying on Maven CLI interpolation "permeable" between Maven 3.9.x and Maven 4, while all the whistle and bells (exposing this via session or project) will be available in Maven 4 only.



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