Skip to content

A mix of new lines and spaces causes empty arguments in the command line #466

@cebaa

Description

@cebaa

This works as expected:

$ mvn -X exec:exec -Dexec.executable=java -Dexec.args="com.example.Main"
...
[DEBUG] Executing command line: [java, com.example.Main]
Caused by: java.lang.ClassNotFoundException: com.example.Main
...

This works as expected as well:

$ mvn -X exec:exec -Dexec.executable=java -Dexec.args="
com.example.Main"
[DEBUG] Executing command line: [java, com.example.Main]
Error: Could not find or load main class com.example.Main
...

As does this:

$ mvn -X exec:exec -Dexec.executable=java -Dexec.args="


com.example.Main"
[DEBUG] Executing command line: [java, com.example.Main]
Error: Could not find or load main class com.example.Main
...

Changing to this (new line after " and spaces before com.example.Main on the next line) causes it to add an additional empty argument to the command line:

$ mvn -X exec:exec -Dexec.executable=java -Dexec.args="
  com.example.Main"
...
[DEBUG] Executing command line: [java, , com.example.Main]
Error: Could not find or load main class
...

This repeats with multiple new line / space combinations:

$ mvn -X exec:exec -Dexec.executable=java -Dexec.args="
  
  
  com.example.Main"
[DEBUG] Executing command line: [java, , , , com.example.Main]
Error: Could not find or load main class
...

It looks to only happen when there's a mix of new lines and spaces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions