Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yezhengli-Mr9 opened this issue Nov 27, 2023 · 0 comments

Comments

@yezhengli-Mr9
Copy link

yezhengli-Mr9 commented Nov 27, 2023

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant