rmannibucau commented on code in PR #13249:
URL: https://github.com/apache/maven/pull/13249#discussion_r4490393094


##########
api/maven-api-cli/src/main/java/org/apache/maven/api/cli/InvokerRequest.java:
##########
@@ -192,6 +193,20 @@ default Optional<OutputStream> stdErr() {
     @Nonnull
     Optional<CIInfo> ciInfo();
 
+    /**
+     * Returns the parsed {@code .mvn/reactor.xml} configuration, if present.
+     *
+     * <p>The configuration is parsed once during invocation setup (pre-DI) 
and reused downstream.
+     * When {@code reactor.xml} is absent, this is empty and the legacy {@code 
maven.config} /
+     * {@code extensions.xml} files remain in use.
+     *
+     * @return an {@link Optional} containing the {@link ReactorConfig}, or 
empty if {@code reactor.xml}
+     *         was not found
+     * @since 4.1.0
+     */
+    @Nonnull
+    Optional<ReactorConfig> reactorConfig();

Review Comment:
   what about deprecating others in the API and consolidating them in reactor 
config?



##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvn/ArgumentTokenizer.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.cling.invoker.mvn;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Quote-aware argument tokenizer for the shorthand form of {@code <options>} 
and {@code <alias>} elements
+ * in {@code .mvn/reactor.xml}.
+ *
+ * <p>The algorithm is identical to {@code JvmConfigParser.parseArguments()} 
(the single-file source launcher
+ * used by shell scripts to parse {@code .mvn/jvm.config}):
+ * <ul>
+ *   <li>Whitespace is the delimiter outside quotes.</li>
+ *   <li>{@code "..."} and {@code '...'} are both supported — quotes are 
stripped, content is kept as a
+ *       single token.</li>
+ *   <li>Outside single-quotes, a backslash ({@code \}) escapes the next 
character literally
+ *       (e.g. {@code \"} → {@code "}, {@code \\} → {@code \}, {@code \ } → a 
literal space).
+ *       Inside single-quotes, backslash has no special meaning.</li>
+ * </ul>
+ *
+ * <p><strong>Note:</strong> {@code JvmConfigParser.java} is a self-contained 
single-file source launcher
+ * invoked directly by shell scripts; it must not share classpath code with 
Maven. This class is an
+ * independent re-implementation of the same algorithm for use within Maven's 
Java classpath.
+ *
+ * @since 4.1.0
+ */
+public final class ArgumentTokenizer {

Review Comment:
   I'd ensure we don't need it so lists are typed as list (ok to have an 
inlined tolerance like in plugin configuration but if you want to control 
exactly the split portably let's explicitly do it in the config)



##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvn/MavenParser.java:
##########
@@ -47,14 +56,110 @@ protected Options parseCliOptions(LocalContext context) {
                 throw new IllegalArgumentException("Specified file does not 
exists (" + file + ")");
             }
         }
-        // maven.config; if exists
-        Path mavenConfig = context.rootDirectory != null ? 
context.rootDirectory.resolve(".mvn/maven.config") : null;
-        if (mavenConfig != null && Files.isRegularFile(mavenConfig)) {
-            result.add(parseMavenConfigOptions(mavenConfig));
+
+        // reactor.xml <options> — used instead of maven.config when 
reactor.xml is present
+        if (context.reactorConfig != null) {

Review Comment:
   we might want to have a kind of rule to superseed previous existing 
configuration when both exist (likely to tolerate multiple maven versions with  
a refined experience in maven 4 but a good enough support for maven 3 IMHO)



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to