Running daemon with exec-maven-plugin avoiding `IllegalThreadStateException`

Posting the answer that is discussed in the comments section of the question. This solution worked for me! Thanks Andrew Logvinov cleanupDaemonThreads = false Something like this in the configuration tag <configuration> <mainClass>com.test.Startup</mainClass> <cleanupDaemonThreads>false</cleanupDaemonThreads> </configuration>

Maven & Java: The parameters ‘mainClass’ for goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or invalid

“configuration” must go outside “executions”, like this: <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <executions> <execution> <goals> <goal>java</goal> </goals> </execution> </executions> <configuration> <mainClass>com.emilio.App</mainClass> </configuration> </plugin> </plugins>

From Maven, how do I run a class that lives under src/test/java?

I faced the same problem and figured it out. Shortly speaking, the class must be compiled before exec:java goal. (It surely works without test-compile phase if the class is already compiled by other user action. Note that Pascal Thivent, in his answer, invoked mvn test before exec:java.) $ mvn -Dexec.mainClass=… -Dexec.classpathScope=test test-compile exec:java You can … Read more