0
votes

I have added build.xml in root directory of java project checkedin in svn successfully.

Now, Following is Console output of jenkin build

  1. Copying
    /var/lib/jenkins/workspace/FinalWar/WebContent/WEB-INF/web.xml to
    /var/lib/jenkins/workspace/FinalWar/build/WebContent/WEB-INF/web.xml
  2. File copy complete. war:Creating WAR file ...Then
  3. BUILD FAILED /var/lib/jenkins/workspace/FinalWar/build.xml:39:
  4. Deployment descriptor:
    /var/lib/jenkins/workspace/FinalWar/build/WEB-INF/web.xml does not
    exist.*

My question is while copying[step 1] web.xml it is getting copied to build/WebContent/WEB-INF/web.xml

But while creating War why it is searching[step 4] for /build/WEB-INF/web.xml

2

2 Answers

0
votes

Check the path.. you are copying it to build/WebContent/WEB-INF and tried reading from build/WEB-INF ... correct the path of reading by including WebContent.

0
votes

First, you need to decide if this is a Jenkins issue or an issue with the build itself.

  1. Does it build on your machine. If it doesn't, your build itself has a problem.
  2. If it builds on your machine, do the following:
    1. Disable the project that's building. You don't want Jenkins to suddenly start building while you're playing around.
    2. In Jenkins, there's a workspace folder in that project. Go into that folder and see if FinalWar/build/WebContent/WEB-INF/web.xml actually exists. If not, you may have an error in your build.xml itself. If it does...
    3. Log into the Jenkins server.
    4. Go into the Jenkins Home directory, then jobs, then the project name, then workspace. This is where Jenkins is running the build.
    5. Try doing the build here. You may have to set your $PATH to pick up the correct version of Ant and the JDK you want to use.

Jenkins doesn't do anything unusual with the build. It run Ant just like you would from the command line. In fact, if you look at the Console output, you'll even see the command line Jenkins used.

There can be issues with builds failing in Jenkins, but not on your command line. Normally, you'll see Jenkins declare a BUILD SUCCESSFUL only to declare it failed a few lines later. This is usually due to a misconfigured post build process -- for example, you attempt to archive an artifact that doesn't exist, or display a test result from a XML file that doesn't exist.

Most of the time, failed Jenkins builds are due to the build itself having problems, and not doing exactly what you want. The first thing when a build fails is to do a CLEAN checkout on your local machine, and try a build. If that works, try running the build from the workspace on the Jenkins build server itself.

And, before you play around with the workspace on the build server, disable the Jenkins project (and don't forget to reenable it after you finished). This way, Jenkins isn't messing up the workspace while you're analyzing what went wrong.