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


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1204,40 +1211,57 @@ void toolchains(CliRequest cliRequest) throws Exception 
{
                         "The specified user toolchains file does not exist: " 
+ userToolchainsFile);
             }
         } else {
-            userToolchainsFile = DEFAULT_USER_TOOLCHAINS_FILE;
+            String userToolchainsFileStr = 
cliRequest.getUserProperties().getProperty(Constants.MAVEN_USER_TOOLCHAINS);
+            if (userToolchainsFileStr != null) {
+                userToolchainsFile = new File(userToolchainsFileStr);
+            }
         }
 
-        File globalToolchainsFile;
+        File installationToolchainsFile = null;
 
-        if 
(cliRequest.commandLine.hasOption(CLIManager.ALTERNATE_GLOBAL_TOOLCHAINS)) {
-            globalToolchainsFile =
+        if 
(cliRequest.commandLine.hasOption(CLIManager.ALTERNATE_INSTALLATION_TOOLCHAINS))
 {
+            installationToolchainsFile =
+                    new 
File(cliRequest.commandLine.getOptionValue(CLIManager.ALTERNATE_INSTALLATION_TOOLCHAINS));
+            installationToolchainsFile = 
resolveFile(installationToolchainsFile, cliRequest.workingDirectory);
+
+            if (!installationToolchainsFile.isFile()) {
+                throw new FileNotFoundException(
+                        "The specified installation toolchains file does not 
exist: " + installationToolchainsFile);
+            }
+        } else if 
(cliRequest.commandLine.hasOption(CLIManager.ALTERNATE_GLOBAL_TOOLCHAINS)) {
+            installationToolchainsFile =
                     new 
File(cliRequest.commandLine.getOptionValue(CLIManager.ALTERNATE_GLOBAL_TOOLCHAINS));
-            globalToolchainsFile = resolveFile(globalToolchainsFile, 
cliRequest.workingDirectory);
+            installationToolchainsFile = 
resolveFile(installationToolchainsFile, cliRequest.workingDirectory);
 
-            if (!globalToolchainsFile.isFile()) {
+            if (!installationToolchainsFile.isFile()) {
                 throw new FileNotFoundException(
-                        "The specified global toolchains file does not exist: 
" + globalToolchainsFile);
+                        "The specified installation toolchains file does not 
exist: " + installationToolchainsFile);
             }
         } else {
-            globalToolchainsFile = DEFAULT_GLOBAL_TOOLCHAINS_FILE;
+            String installationToolchainsFileStr =
+                    
cliRequest.getUserProperties().getProperty(Constants.MAVEN_INSTALLATION_TOOLCHAINS);
+            if (installationToolchainsFileStr != null) {
+                installationToolchainsFile = new 
File(installationToolchainsFileStr);
+                installationToolchainsFile = 
resolveFile(installationToolchainsFile, cliRequest.workingDirectory);
+            }

Review Comment:
   > Then it should be `${session.rootDirectory}`
   
   That'd be perfect.



-- 
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

Reply via email to