I am working on a multi module maven project, in which I need to run the same execution
multiple times with only 1 or 2 different parameters.
Basically, at the end of the build we are starting the resulting jar
with some parameters, to execute a few simple build-in checks.
The execution looks something like this:
<execution>
<id>exec-build-in-checks</id>
<phase>verify</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.exe}</executable>
<workingDirectory>${project.build.directory}</workingDirectory>
<arguments>
<argument>-classpath</argument
<argument>${app.classpath}</argument>
<argument>${app.mainClass}</argument>
<argument>-someCommonArgument</argument>
<argument>-anotherCommonArgument</argument>
<argument>-someModuleDependentArgument</argument>
<argument>-someUniqueArgument</argument>
</arguments>
</configuration>
</execution>
Now in the same module
I have the same execution multiple times but with different values for someUniqueArgument
. Cause of this I need to duplicate the whole execution
block multiple times only to change one argument.
Also, I need the same execution in multiple modules but with a different value for someModuleDependentArgument
.
So what I would like to do is to create an execution which I can call with different parameters form inside maven.
A solution I could think about is to use parameters inside the execution and change the value of those parameters in maven between the execution
calls. However, I couldn't find a way to do this.
So is there a way to reuse the same execution
with a few different parameter values?
EDIT:
Just to make it clear: The execution
s should be executed in the same build, so profiles or passing command line args is not a solution in this case.