I'm trying to use exec-maven-plugin with the java
goal. However, I am confused by the difference between the two options:
If I try using arguments, the call to my java class fails.
The signature of my class being called is:
public static void main(String[] args)
{
VeracodeParser parser = new VeracodeParser();
parser.parse(args);
}
My pom:
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>Zip packaging and deployment</id>
<phase>process-sources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.veracode.apiwrapper.cli.VeracodeCommand</mainClass>
<arguments>
<argument>-action GetAppList</argument>
<argument>-vuser ${veracode.username}</argument>
<argument>-vpassword ${veracode.password}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
However, I get error messages from my VeracodeCommand class indicating that I am missing my -action
, -vuser
and -vpassword
arguments.
However, when I switch it to using a single string commandlineArgs
parameter, it works as expected:
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>Zip packaging and deployment</id>
<phase>process-sources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.veracode.apiwrapper.cli.VeracodeCommand</mainClass>
<commandlineArgs>-action UploadFile -vuser ${veracode.username} -vpassword ${veracode.password} -appid ${veracode.appId} -filepath ${project.build.directory}/dependency/sbip_ear_pres.ear</commandlineArgs>
</configuration>
</execution>
</executions>
</plugin>
The problem is that <commandlineArgs>
will become unwieldy long. Which is why I would have preferred using the <arguments>
parameter.
Can anyone explain to me the difference between the two and/or if/how I can use the arguments
parameter?
Maybe you have to provide your arguments in that way, individually? according to the post in Maven - pass argument to use in exec-maven-plugin
<arguments>
<argument>-action</argument>
<argument>GetAppList</argument>
<argument>-vuser</argument>
<argument>${veracode.username}</argument>
<argument>-vpassword</argument>
<argument>${veracode.password}</argument>
</arguments>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With