mojohaus / mojohaus/exec-maven-plugin
Passing argument -p to java application
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 191
- Forks
- 111
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 4
Description
When trying to use the exec goal in order to run a java application the argument -p is not passed to the java application as an argument.
I attached a minimal maven project to reproduce the issue: ExecMavenIssueTest.zip
Java application for testing:
package test.it.out;
import java.util.Arrays;
public class MainApp {
public static void main(String... args) {
System.out.println("Arguments: " + Arrays.toString(args));
}
}
exec-maven-plugin configuration:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<!-- This only works with 3.0.0 but not with 3.1.0! -->
<execution>
<id>execution-no-quotes</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>test.it.out.MainApp</argument>
<argument>-p</argument>
<argument>-q</argument>
<argument>-r</argument>
</arguments>
<classpathScope>runtime</classpathScope>
</configuration>
</execution>
<!-- When quoting the "-p" argument, it works with 3.1.0 too! -->
<execution>
<id>execution-with-quotes</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>test.it.out.MainApp</argument>
<argument>"-p"</argument>
<argument>-q</argument>
<argument>-r</argument>
</arguments>
<classpathScope>runtime</classpathScope>
</configuration>
</execution>
</executions>
</plugin>
Output for 3.1.0:
...
[INFO]
[INFO] --- exec-maven-plugin:3.1.0:exec (execution-no-quotes) @ runner ---
Arguments: [-p, -r]
[INFO]
[INFO] --- exec-maven-plugin:3.1.0:exec (execution-with-quotes) @ runner ---
Arguments: [-p, -q, -r]
...
Output for 3.0.0:
...
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:exec (execution-no-quotes) @ runner ---
Arguments: [-p, -q, -r]
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:exec (execution-with-quotes) @ runner ---
Arguments: [-p, -q, -r]
...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached minimal Maven project and the exec goal configuration, comparing 3.1.0's argument handling with 3.0.0. Reproduce the no-quotes case and verify that the Java application receives -p, -q, and -r in order while the quoted case remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100