In my project, Tomcat is deploying a WAR file. The WAR file is trying to run maven on another project:
List<String> args = new ArrayList<String>();
args.add("mvn");
for (String goal : goals) {
args.add(goal);
//Here, goals is { "clean", "compile", "test", "dependency:copy-dependencies" }
}
ProcessBuilder processBuilder = new ProcessBuilder(args).directory(workingDir);
processBuilder.redirectErrorStream();
Process process = processBuilder.start();
However, tomcat cannot run maven and is giving this error:
java.io.IOException: Cannot run program "mvn" (in directory "C:/..."): CreateProcess error=2, The system cannot find the file specified
I'm new to Tomcat and Maven, but I'm pretty sure I have JAVA_HOME, CATALINA_HOME, MAVEN_HOME all set up correctly to their bin folders, and added to PATH as well. I'm not using any IDE, just using cmd and browser.
Is there some kind of configuration in Tomcat which does not allow it to run external processes? Can that be changed?
Thanks for the help!