gnodet opened a new pull request, #13150:
URL: https://github.com/apache/maven/pull/13150

   ## Problem
   
   `maven.config` uses a *one-argument-per-line* format (introduced by 
MNG-7131, commit `331c5c3435`, July 2021), modelled after Java `@argfiles`. 
Each line is a single argv token — whitespace inside a line is never re-split. 
This allows property values containing spaces:
   
   ```
   # .mvn/maven.config
   --define
   label=Apache Maven
   ```
   
   The two lines are passed as two separate tokens to Commons CLI, which 
consumes the second as the argument to `--define`.
   
   PR #13093 (`2829a73de4`) broke this contract by adding `flatMap(line -> 
CleanArgument.splitLine(line).stream())` in 
`MavenParser.parseMavenConfigOptions`, re-tokenizing each line on unquoted 
whitespace. It was reverted in #13148. There were no regression tests 
protecting this contract, so this PR adds them.
   
   ## Changes
   
   ### `compat/maven-embedder`
   
   - New test fixture: 
`compat/maven-embedder/src/test/projects/mavenConfigSpacedValues/.mvn/maven.config`
  
     Uses the `--define` / `value with spaces` two-line form for two properties.
   - New test: `MavenCliTest#testMavenConfigMultiLineDefineWithSpaces()`  
     Calls `initialize` → `cli` → `properties` and asserts both user properties 
are parsed correctly.
   
   ### `impl/maven-cli`
   
   - New test class: `MavenParserTest` (same package as `MavenParser` for 
`protected` access)  
     Five test cases covering:
     1. `testMultiLineDefineWithSpacedValue` — core regression: `--define` / 
`label=Apache Maven` must yield `label=Apache Maven` (the exact case #13093 
broke)
     2. `testMultiLineDefineSimple` — two-line form without spaces
     3. `testSingleLineDefine` — compact `-Dkey=value` form still works
     4. `testCommentsAndEmptyLinesSkipped` — comment/blank lines are filtered
     5. `testGoalRejected` — goals throw `IllegalArgumentException`
   
   ## Testing
   
   ```
   mvn verify -pl compat/maven-embedder -am -B   # MavenCliTest: 1/1 PASS
   mvn verify -pl impl/maven-cli -am -B          # MavenParserTest: 5/5 PASS
   ```
   


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