I am converting my Ant project to a Maven project.
In Ant I am invoking a Java class but in a different thread using fork="yes"
option in Ant.
Now I am trying to find a similar task in Maven.
I have code like the following, but I'm not sure if it is correct or not. It is calling my main class as expected, but it is running in the same thread/JVM.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.App</mainClass>
<arguments>
<argument>-s src/main/resources</argument>
</arguments>
</configuration>
</plugin>
Here com.App is a class which has a main method.
I need to run this in a different thread because the App.main() method contains a call to system.exit()
, so the control is not coming back. As I am not authorized to change the App class, I have to call that in a different thread.