I am unable to execute maven command via script using java. The maven command is suppose a create an archetype folder which is not being created.
This is what the java code looks like :
ProcessBuilder pb = new ProcessBuilder("/log/script.sh");
pb.directory(new File("/log"));
Process p = pb.start();
p.waitFor();
IOUtils.copy(p.getInputStream(), System.out);
This is what script.sh looks like
mvn archetype:generate -B -DarchetypeGroupId=my.archetype -DarchetypeArtifactId=archetype -DarchetypeVersion=1.0.0-SNAPSHOT -DgroupId=my.groupid -DartifactId=artifact -Dpackage=my.groupid.artifact -Dversion=1.0.0-SNAPSHOT -DarchetypeRepository=<link-to-repo>
ls
I can see in the output of the ls command that the folder that was supposed to be created by the maven command is not getting created, whereas, when I try running the script from the terminal, it gets created. I have giving the folder 777 permission. Can someone let me know what I might be doing wrong ?