mojohaus / mojohaus/exec-maven-plugin

arguments and commandlineArgs seem to be mutually exclusive

Open
#102 1 comment 2 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

When I specify both arguments and commandlineArgs when executing the java goal, the latter supplants the former value.

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>1.6.0</version>
                    <configuration>
                        <mainClass>${mainClass}</mainClass>
                        <commandlineArgs>-Duser.dir=${project.basedir}</commandlineArgs>
                        <arguments>
                            <argument>server</argument>
                        </arguments>
                    </configuration>
                </plugin>

In this case, I would like to pass arguments to the JVM and my class that differ. In fact the log seems to indicate that is actually what happens:

[DEBUG] Invoking : com.whoever.Application.main(server)

However, in reality the arguments configuration is overwritten by the commandlineArgs within the private method ExecJavaMojo.addRelevantPluginDependenciesToClasspath. This seems to be incorrect behavior... at least when arguments configuration is supplied.

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 reading the java goal handling around the private method ExecJavaMojo.addRelevantPluginDependenciesToClasspath and reproduce the configuration shown in the issue. Trace how arguments and commandlineArgs are combined when both are supplied. Done means the JVM receives the command-line option while Application.main still receives server, with coverage for this configuration if the existing tests provide a suitable entry point.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.