mojohaus / mojohaus/exec-maven-plugin

how to pass command line arguments to exec:java as pom.xml variable/ parameter?

Open
#399 0 comments 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

how to pass command line arguments to exec:java as pom.xml variable/ parameter?

mvn clean install exec:java -Dexec.args="d"
mvn clean install exec:java -Dexec.args="s"

and then <mainClass>${mainClass.${args1}}</mainClass> can refer to ${mainClass.d}, ${mainClass.s} separately?

            <properties> 
                 <mainClass.d>io.DumpBatch</mainClass.d>
                 <mainClass.s>io.Stream</mainClass.s>
            </properties>
...
            <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <mainClass>${mainClass}</mainClass>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>${mainClass}</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>

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 with the exec:java configuration and Maven command examples in the issue, then check the plugin documentation and Maven property-handling guidance. Confirm whether command-line values can select the configured main class, and document the supported approach or limitation with a working example.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.