4

I'm trying to build simple android project from Jenkins, but build fails with output message (verbose):

Building in workspace /var/lib/jenkins/jobs/MyProj/workspace
[MyProj] $ ant -file build.xml help -v
Apache Ant version 1.8.1 compiled on October 13 2010
Buildfile: /home/ramps/MyProj/build.xml
Detected Java version: 1.6 in: /usr/lib/jvm/java-6-openjdk/jre
Detected OS: Linux
parsing buildfile /home/ramps/MyProj/build.xml with URI = file:/home/ramps/MyProj/build.xml
Project base dir set to: /home/ramps/MyProj
parsing buildfile jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
 [property] Loading /home/ramps/MyProj/local.properties
 [property] Loading /home/ramps/MyProj/ant.properties
Importing file /home/ramps/MyProj/custom_rules.xml from /home/ramps/MyProj/build.xml
Cannot find /home/ramps/MyProj/custom_rules.xml imported from /home/ramps/MyProj/build.xml
Importing file /usr/share/android-sdk-linux/tools/ant/build.xml from /home/ramps/MyProj/build.xml

BUILD FAILED
/home/ramps/MyProj/build.xml:81: Cannot find /usr/share/android-sdk-linux/tools/ant/build.xml imported from /home/ramps/MyProj/build.xml
    at org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:181)
    at org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:162)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:179)
    at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:82)
    at org.apache.tools.ant.Main.runBuild(Main.java:786)
    at org.apache.tools.ant.Main.startAnt(Main.java:218)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
  • MyProj is a clean project created via:

    android create project --name MyProj --package com.myproj --target "android-15" --path MyProj --activity MyProj

  • of course file "/usr/share/android-sdk-linux/tools/ant/build.xml" exist.

  • "ant help" from shell runs fine.
  • local.properties contains valid path to android SDK:

    sdk.dir=/usr/share/android-sdk-linux

Any idea why MyProj/build.xml cannot find "/usr/share/android-sdk-linux/tools/ant/build.xml" ?

1 Answer 1

7

Ok, I managed to solve it. User jenkins had no permission to enter android-sdk-linux folder.

In general, when debugging such issues it is very helpful to try to do manually what Jenkins is doing:

$sudo su jenkins

And now, as jenkins user try to enter folders, create new one etc.

3
  • i don't think so that running jenkins as a root it is good idea. i believe that jenkinks now runs jobs as a root, what could be very malicious/dangerous/insecure
    – bluszcz
    Sep 24, 2012 at 10:31
  • 1
    Sorry, I see my answer was not clear. Of course you are right, running jenkins as a root is totally wrong idea. What I meant here is to switch to jenkins user in shell, just for investigating, to see what folders can be entered etc.
    – Ramps
    Sep 24, 2012 at 15:22
  • similar question. I also had this issue on a jenkins setup that worked before after enabling security on the jenkins container. Didn't check yet what user then should get the permissions. My feedback is on this similar question: stackoverflow.com/questions/11752594/… Jan 15, 2013 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.