Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.1.1
-
Fix Version/s: None
-
Component/s: exec
-
Labels:None
-
Environment:Fedora release 11 (Leonidas),
-
Number of attachments :
Description
When trying to run a java executable the class path string generated using the <classpath> argument is being placed at the end of the generated command string unless it is the very first argument in which case it is places directly after the "java" command.
For example:
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>com.example.Main</argument>
<arguments>
</arguments>
Produces:
java -classpath com.example.Main {the classpath dependencies here}
This appears to be because elements in the <arguments> list with the same name are concatenated.
For example:
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>com.example.Main</argument>
<arguments>
is essentially the same as:
<arguments>
<argument>-classpath com.example.Main</argument>
<classpath/>
<arguments>
I'm not sure if this is intended functionality but since it breaks the example on the Exec website I'd assume not. I'm new to Maven but this concatenation does not appear to be coming from the ExecMojo code and I'd guess has something to do with the way the pom elements are being parsed before being passed into the ExecMojo object.
A workaround appears to utilise the fact that elements in the <arguments> list currently DO NOT have to be named <argument>.
For example:
<arguments>
<classpathArg>-classpath</classpathArg>
<classpath/>
<mainClassArg>com.example.Main</mainClassArg>
<progArg1>113</progArg1>
<arguments>
Produces:
java -classpath {the classpath dependencies here} com.example.Main 113