ProcessBuilder does not work with maven and jenkins

1.1k views Asked by At

I am trying to execute a command through the windows cmd via ProcessBuilder(which is invoked by maven target, which in turn is a jenkins triggered job) but it is not being executed.

Here is my workflow so far.

  1. Jenkins I have a job SomeJob, which is manually triggered.
  2. One of the targets from my maven project is mvn compile exec:java and in my pom.xml I have http://pastebin.com/SfDsxfJm

  3. In the flow of my main class, I have

ProcessBuilder builder = new ProcessBuilder("CMD", "/C", my_executable.exe,sourcefile,destfile);
builder.start();

However, when I trigger the jenkins build, it does not throw any error, but the destination files are not generated. All paths are absolute as of now, but still I am having the issue.

If I run the maven command, directly on the slave,

mvn -f C:\\myproject\pom.xml mvn compile exec:java

Then the files are generated as usual. I am unable to proceed as to how to debug this issue. Any help is appreciated. Thanks

0

There are 0 answers