mojohaus / mojohaus/exec-maven-plugin

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

Open
#466 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
191
Forks
111
Avg merge
1d 21h
Merged PRs (30d)
4

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the mixed-newline-and-space cases through the exec:exec entry point and inspect how its exec.args value is split into command-line arguments. Done means whitespace combinations no longer create empty arguments, while the examples produce the expected [java, com.example.Main] command line.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.