I am trying to use the maven-exec-plugin to launch the ejbdeploy command for my old project made with EJB 2.1
The thing is that one of the argument of the command is another command (RMIC) which has arguments too that I need to use.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>ejb-deploy</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>ejbdeploy</executable>
<arguments>
<argument>${project.build.directory}\${project.build.finalName}.jar</argument>
<argument>${project.build.directory}\working</argument>
<argument>${project.build.directory}\${project.build.finalName}-deployed.jar</argument>
<argument>-rmic "-d C:\java\classes"</argument>
<argument>-cp</argument>
<classpath/>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
This snippet generates an error during my mvn clean install :
[INFO] --- exec-maven-plugin:1.5.0:exec (ejb-deploy) @ SIMBOLight ---
Unrecognized option: -rmic -d.
Unrecognized option: C:\java\classes.
Error: Must specify the input JAR/EAR filename, the working directory, and output JAR/EAR filename.
0 Errors, 0 Warnings, 0 Informational Messages
It's like I am malformatting my parameters. Any ideas ?
When passing arguments with the
exec-maven-plugin, you need to make sure that each<argument>don't contain unescaped space characters. Each argument must be given as a separate<argument>.In your case,
-rmic "-d C:\java\classes"is actually formed of 2 arguments: the first one is-rmicand the second one is"-d C:\java\classes"(which contains an escaped space), so you can't pass them into a single<argument>.As such, you can have the following configuration:
When configured with those arguments, the
mainmethod of the launched executable will take-rmicas the 3rd element in the argument array, and-d C:\java\classesas the 4th element in the argument array.