Home » Java » java – how to avoid Shutting down ExecutorService while running mvn compiler:testCompile programmatically?-Exceptionshub

java – how to avoid Shutting down ExecutorService while running mvn compiler:testCompile programmatically?-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

I have maven project with Spring boot, in which I am using Process command as below:

Process process = Runtime.getRuntime().exec(“cmd /c mvn
compiler:testCompile”, null, new File(UPLOADED_FOLDER));

UPLOADED_FOLDER: contains the path of main project directory, where pom.xml file is available.
Command executes successfully.

This command executes in a running application, so when it executes it stops my server, i.e Shutting down ExecutorService.

Purpose of using this command is:

I want to compile the newly uploaded Test cases (TestNg), but some how my server service is getting shutdown.

Help is required, in executing it with avoid shutdown of service or any other way around to compile the test cases (.java files).

How to&Answers: