0
votes

I am re-setting up Jenkins 1.5888 on our Mac OS X box. I have googled much about this problem and have come up with the following steps.

I upgraded all plugins as requested.

From Configure System, I set up the Ant plugin to automatically download from the Apache site. I have called this installation Default.

I added and invoke ant step to my build. I selected Default a my ant installation

I ran the build. Here is the part of the output that is causing my frustration:

[participant-test] $ ant -file build.xml clean emma debug install test FATAL: command execution failed.Maybe you need to configure the job to choose one of your Ant installations? java.io.IOException: Cannot run program "ant" (in directory "/Users/bob/.jenkins/jobs/participant/workspace/participant-test"): error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047) at hudson.Proc$LocalProc.(Proc.java:244) at hudson.Proc$LocalProc.(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:803) at hudson.Launcher$ProcStarter.start(Launcher.java:381) at hudson.Launcher$ProcStarter.join(Launcher.java:388) at hudson.tasks.Ant.perform(Ant.java:217) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770) at hudson.model.Build$BuildExecution.build(Build.java:199) at hudson.model.Build$BuildExecution.doRun(Build.java:160) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533) at hudson.model.Run.execute(Run.java:1759) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:89) at hudson.model.Executor.run(Executor.java:240) Caused by: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.(UNIXProcess.java:184) at java.lang.ProcessImpl.start(ProcessImpl.java:130) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028) ... 15 more Build step 'Invoke Ant' marked build as failure

I can run ant from the command line just fine for the same exact build. I've been at this for a day. I've found some similar issues that appear to be for older versions of Jenkins and don't seem to apply.

3

3 Answers

0
votes

The exception seems to be because of missing Ant Home in the job configuration .. check if you have one ? And before executing from Jenkins also check if you are able to invoke ant commands from command line

0
votes

In the end, we just kept trying things until it worked. The automatic install appears not to have been working.

I installed the JDK automatically. I'm not sure that part of the problem with ant was no java inside of Jenkins.

I then manually downloaded ant from the apache site and installed it within the .jenkins directory in the build user's home directory under tools. I added the ANT_HOME environment variable, added it to my path, and rebooted to make sure everything had it.

I pointed the manually configured ant to this above home directory and then pointed my build to this configuration. I believe this combination is what fixed my issue.

0
votes

In my case I was running incompatible java version.

Jenkins requires Java in order to run, however yum install jenkins does not enforce that java is already installed. Check to make sure that you already have java installed by running java -version. To further make things difficult for CentOS users, the default CentOS version of Java is not compatible with Jenkins. Jenkins typically works best with a Sun implementation of Java, which is not included in CentOS for licensing reasons.

If you get output similar to the following, it means you're using the default (GCJ) version of Java, which will not work with Jenkins:

Remove old java version: # yum remove java Install new version : # yum install java-1.7.0-openjdk