Skip to content

[MNG-7131] maven.config doesn't handle arguments with spaces in them#488

Closed
michael-o wants to merge 1 commit intomasterfrom
MNG-7131
Closed

[MNG-7131] maven.config doesn't handle arguments with spaces in them#488
michael-o wants to merge 1 commit intomasterfrom
MNG-7131

Conversation

@michael-o
Copy link
Copy Markdown
Member

Since we don't have a clear specification of the file format change
reading of the file to a one-arg-per-line basis just like Java's
@argfiles or Python's argparse would handle it.
Consider that jvm.config suffers from the same issue its parsing is not
portable between Bourne shell and Windows Command prompt.

We also need to change this and mention that jvm.config parsing is not portable.

I am inclined to backport this to 3.8.x although this might break for people for two reasons:

  • Consistency between Maven 3 and 4
  • Config files can be changed and will continue to work on older Maven versions
  • All other arg file approaches use a one-arg-per-line approach

if ( configFile.isFile() )
{
for ( String arg : new String( Files.readAllBytes( configFile.toPath() ) ).split( "\\s+" ) )
for ( String arg : Files.readAllLines( configFile.toPath(), Charset.defaultCharset() ) )
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I have retained the original file encoding because jvm.config is subject to the same platform encoding. We can consider making maven.config UTF-8 only.

Comment thread maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java Outdated
Comment thread maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java Outdated
Comment thread maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java Outdated
Comment thread maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java Outdated
Since we don't have a clear specification of the file format change
reading of the file to a one-arg-per-line basis just like Java's
@argfiles or Python's argparse would handle it.
Consider that jvm.config suffers from the same issue its parsing is not
portable between Bourne shell and Windows Command prompt.
@michael-o
Copy link
Copy Markdown
Member Author

@rfscholte Should this be back ported to 3.8.x too?

@rfscholte
Copy link
Copy Markdown
Contributor

I don't know what your goal with the backport is or what the scope is. I'm just worried that it becomes bigger and bigger.
For me this isn't regression, just an improvement of an edge case, I'll leave it up to you if you want to add such changes too.

@michael-o
Copy link
Copy Markdown
Member Author

I don't know what your goal with the backport is or what the scope is. I'm just worried that it becomes bigger and bigger.
For me this isn't regression, just an improvement of an edge case, I'll leave it up to you if you want to add such changes too.

Goal is actually consistency when migrating from 3 to 4. But you are right, this isn't a regression. Just an improvement of an edge case. If someone needs that in 3.x they can still raise a hand.

@michael-o
Copy link
Copy Markdown
Member Author

Merged.

@michael-o michael-o closed this Jul 21, 2021
@michael-o michael-o deleted the MNG-7131 branch July 21, 2021 12:32
@jira-importer
Copy link
Copy Markdown

Resolve #8332

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants