Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

Conversation

michael-o
Copy link
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

@@ -387,7 +388,7 @@ void cli( CliRequest cliRequest )

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

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

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

@rfscholte
Copy link
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
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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants