0

I set up an ant project and successfully built a project.

Started by user anonymous
Building in workspace /home/myusername/jenkins/workspace/ctascweb
[ctascweb] $ cvs -q -z3 update -PdC -r ctascweb-development-3_3_8 -D "Wednesday, November 28, 2012 10:20:13 PM UTC"
? ROOT.war
? build
U src/stdy/analyze/LoadSubjects.java
$ computing changelog
[ctascweb] $ ant -file build_hudson.xml
Buildfile: build_hudson.xml

init:
     [echo] Base Directory : /home/myusername/jenkins/workspace/ctascweb 

gen-footer:

compile-ctpm:
     [echo] Compiling ctpm files
    [javac] Compiling 1 source file to /home/myusername/jenkins/workspace/ctpm/bin

generate-ctpm-jar:
     [echo] Building CTPM jar file
      [jar] Building jar: /home/myusername/jenkins/workspace/ctpm/build/ctpm.jar

compile-ctascweb:
     [echo] Compiling ctascweb files
    [javac] Compiling 1 source file to /home/myusername/jenkins/workspace/ctascweb/build/classes
    [mkdir] Created dir: /home/myusername/jenkins/workspace/ctascweb/build/classes/resource

build-ctascweb-war:
     [echo] Building WAR file for ctascweb
      [war] Building war: /home/myusername/jenkins/workspace/ctascweb/ROOT.war
     [echo] Nov-28-2012 05:20:48

BUILD SUCCESSFUL
Total time: 7 seconds
Archiving artifacts
Finished: SUCCESS

I shut down my Tomcat and came back next work. I did not make any changes in my configuration and started the build again and the build failed.

Started by user anonymous
Building in workspace /home/myusername/jenkins/jobs/ctascweb/workspace
[ctascweb] $ cvs -Q -z3 -d :pserver:myusername:pwd@5.0.0.146:/CVS_RESP01 co -P -r ctascweb-development-3_3_8 -d workspace -D "Thursday, November 29, 2012 2:41:16 PM UTC" ctascweb
$ computing changelog
[workspace] $ ant -file build_hudson.xml
Buildfile: build_hudson.xml

init:
    [mkdir] Created dir: /home/myusername/jenkins/jobs/ctascweb/workspace/build/classes
     [echo] Base Directory : /home/myusername/jenkins/jobs/ctascweb/workspace 

gen-footer:

BUILD FAILED
java.io.FileNotFoundException: /home/myusername/jenkins/jobs/ctascweb/ctpm/src/com/ctasc/ctpm/layout/StdyFooter.java (No such file or directory)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
    at java.io.FileWriter.<init>(FileWriter.java:61)
    at org.apache.tools.ant.taskdefs.Echo.execute(Echo.java:67)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    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:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
    at org.apache.tools.ant.Main.runBuild(Main.java:758)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Archiving artifacts
Finished: FAILURE

For some reason, the worspace changed from /home/myusername/jenkins/workspace/ctascweb to /home/myusername/jenkins/jobs/ctascweb/workspace. Why would that happen? The only thing I did is stopped and restarted the Tomcat server?

user203617
  • 523
  • 8
  • 20

3 Answers3

0

Are you the admin of the Hudson/Jenkins server?

If the version was recently updated (in particular from Hudson to Jenkins), there is a difference in the path that's used for project's workspace (which can be changed in configuration). You should always use ${WORKSPACE} variable instead of directly referencing any path

Also, these lines look different, so there was more than just Tomcat restart
[ctascweb] $ cvs -q -z3 update -PdC -r ctascweb-development-3_3_8 -D "Wednesday, November 28, 2012 10:20:13 PM UTC"

[ctascweb] $ cvs -Q -z3 -d :pserver:myusername:pwd@5.0.0.146:/CVS_RESP01 co -P -r ctascweb-development-3_3_8 -d workspace -D "Thursday, November 29, 2012 2:41:16 PM UTC" ctascweb

Slav
  • 27,057
  • 11
  • 80
  • 104
  • Thanks for your reply. I've downloaded Jenkins from here : https://wiki.jenkins-ci.org/display/JENKINS/Meet+Jenkins and deployed in Tomcat using http://localhost:8080/manager/html and I've not set up any accounts. I simply accessed Jenkins at http://localhost:8080/jenkins. I checked in some code, it picked my changed from CVS in the second build. – user203617 Nov 29 '12 at 15:43
  • Just clarifying my last comment.. I mean I just checked in some code and it picked up but the build still failed. No other changes were done in Jenkins. – user203617 Nov 29 '12 at 21:06
  • The second workspace in your OP `/home/myusername/jenkins/jobs/ctascweb/workspace` seems to be the correct workspace for Jenkins jobs. Not sure how you managed to get the first workspace path, as it seems totally wrong. The issue you are having now could be because your build is expecting some files, however the workspace is in fact empty. Since this is not a full build, it's not rebuilding all it needs. Try this: Select your job, click "Workspace" on the left, then click "Wipeout workspace". Then run the build again, which will do a fresh checkout and build – Slav Nov 29 '12 at 21:43
0

Look for any changes in configuration of job from UI. Goto Advanced options and see if someone has unchecked your custom workspace as seems to be the case. Also can I get to see your build_hudson.xml. There may be some issues with the way you used path in the build file.

0

Yes the Jenkins workspace folder is changing based on the way we run it. I had seen this in windows XP on my machine.

When I run the JAR file using java -jar jenkins.war

It is .jenkins/workspace/<job_name>

When I installed it as a windows service, the workspace folder changed to .jenkins/<job_name>/workspace

Harshavardhan Konakanchi
  • 4,238
  • 6
  • 36
  • 54