Jenkins error: "Unable to delete file" when calling Ant

I am running Jenkins 1.433 on Ubuntu 11.04 to complete a build that includes an Ant task. Part of cleanmy Ant task, which removes the directory buildfrom previous builds, will work on startup sudo Antfrom the terminal, but not with Jenkins with the following:

BUILD FAILED
/var/lib/jenkins/workspace/AomaTests/build.xml:47: Unable to delete directory /var/lib/jenkins/workspace/AomaTests/build

The Ant installation referenced by Jenkins is the one that works from the command line ( usr/bin/ant), and the Jenkins project specifically points to this instance (and not to Default). Assuming this is a permissions issue, I tried the following:

  • chown -Rappropriate directory buildby setting its owner in jenkins.
  • Execution chmod 777in the directory.
  • Temporary permission of jenkinsthe username to the ability to run things without a password (by editing the file sudoersusing a line jenkins ALL = NOPASSWD:ALL).

None of these approaches work. Should I run Ant through another user, or perhaps pass some properties to him through Jenkins?

Update . Conclusion ps -ef | grep "jenkins":

jenkins   1647     1  0 12:28 ?        00:00:00 /usr/bin/daemon --name=jenkins --inherit --env=JENKINS_HOME=/var/lib/jenkins --output=/var/log/jenkins/jenkins.log --pidfile=/var/run/jenkins/jenkins.pid -- /usr/bin/java -jar /usr/share/jenkins/jenkins.war --webroot=/var/run/jenkins/war --httpPort=8080 --ajp13Port=-1
jenkins   1660  1647  7 12:28 ?        00:00:13 /usr/bin/java -jar /usr/share/jenkins/jenkins.war --webroot=/var/run/jenkins/war --httpPort=8080 --ajp13Port=-1
mattcarp  2393  2229  0 12:31 pts/0    00:00:00 grep --color=auto jenkins

Running ls -lin a directory that cannot be deleted (when starting from Jenkins):

drwxr-xr-x 2 jenkins root 4096 2011-10-03 14:49 build

Thanks so much for any advice!

+5
source share
2 answers

As it turned out, all that was required was to establish the parent owner of the directory jenkins.

- !

+6

? . , Java, Jenkins. . :

 $ ps -ef | grep "jenkins"

, .

, - , , , , /home/mattcarp, - , - . , Jenkins mattcarp.

  • ? ? , . , Jenkins /home/jenkins, /home/jenkins/jobs, foo /home/jenkins/jobs/foo/workspace. $HOME?
  • Ant build.xml? /home/mattcarp/workspace/... build.xml? , build.xml, , .
0

All Articles