Ant with Hudson

I have a problem running Job in Hudson. I configured Hudson with ANT_HOME using the ant and JDK paths, as well as the relative path. And I created a new job where I set up the SVN path and the rest of things. My build.xml file is located in the root folder of the project /build/build.xml

And they I added build.xml on Linux. This is true.

<project name="Test Job" default="build"> <target name="clean"> <delete dir="${basedir}/svn/_build"/> <delete dir="${basedir}/build"/> </target> <target name="prepare"> <mkdir dir="${basedir}/svn/_build/logs"/> <mkdir dir="${basedir}/build/logs"/> <mkdir dir="${basedir}/build/docs"/> </target> <target name="build" depends="clean,prepare"/> </project> 

Note. My task name is set as usercentral.

Then I tried to build now on Hudson. This gives me an error below.

  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 "/root/.hudson/jobs/userCentral/workspace/branches/branches/build"): java.io.IOException: error = 2, No such file or directory
     at java.lang.ProcessBuilder.start (ProcessBuilder.java:460)
     at hudson.Proc $ LocalProc. (Proc.java:192)
     at hudson.Proc $ LocalProc. (Proc.java:164)
     at hudson.Launcher $ LocalLauncher.launch (Launcher.java:638)
     at hudson.Launcher $ ProcStarter.start (Launcher.java:273)
     at hudson.Launcher $ ProcStarter.join (Launcher.java:280)
     at hudson.tasks.Ant.perform (Ant.java:216)
     at hudson.tasks.BuildStepMonitor $ 1.perform (BuildStepMonitor.java:19)
     at hudson.model.AbstractBuild $ AbstractRunner.perform (AbstractBuild.java:603)
     at hudson.model.Build $ RunnerImpl.build (Build.java:172)
     at hudson.model.Build $ RunnerImpl.doRun (Build.java:137)
     at hudson.model.AbstractBuild $ AbstractRunner.run (AbstractBuild.java:417)
     at hudson.model.Run.run (Run.java:1362)
     at hudson.model.FreeStyleBuild.run (FreeStyleBuild.java:46)
     at hudson.model.ResourceController.execute (ResourceController.java:88)
     at hudson.model.Executor.run (Executor.java:145)
 Caused by: java.io.IOException: java.io.IOException: error = 2, No such file or directory
     at java.lang.UNIXProcess. (UNIXProcess.java:148)
     at java.lang.ProcessImpl.start (ProcessImpl.java:65)
     at java.lang.ProcessBuilder.start (ProcessBuilder.java:453)
     ... 15 more
 Finished: FAILURE 

Can someone help me.

+6
java svn hudson ant
source share
4 answers

Add $ANT_HOME/bin to the existing PATH so that Hudson can look for the ant ... command, or at least how I fixed the exact same problem.

+6
source share

Give hudson the absolute path to your ant installation. You can do this in configurations. Then just use this ant installation in your builds. You do not need to specify ANT_HOME.

+3
source share

First, I told Hudson to use some version of Ant that he automatically installed, and give this version of Ant a name. (From the Ant section on the Hudson-> Configure System Page Management page)

Secondly, I talked about a new project called Ant. (Under "Invoke Ant Project Configuration"

+1
source share

It looks like this could be a permissions issue. Does the hudson user have access to the directory path for all relevant files and directories?

0
source share

All Articles