3

I have done my Automation in java using Junit and push that code to bitbucket and integrated it with jenkins. But when i am starting build after creating job it start failling and throwing some error. i am not able get that why it is not taking class path and how i can set class path to avoid this issue
Here is error coming on console

    [javac] C:\Program Files\Jenkins\workspace\ABC-first-job\tst\com\cb\abc\ABCTest.java:110: error: cannot find symbol
[javac]         Assert.assertTrue(response.contains(ABCConstant.DATA_MESSAGE));
[javac]         ^
[javac]   symbol:   variable Assert
[javac]   location: class ABCTest
[javac] 47 errors

BUILD FAILED
C:\Program Files\Jenkins\workspace\ABC-first-job\build.xml:48: Compile failed; see the compiler error output for details.

Total time: 2 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
napendra
  • 378
  • 4
  • 12
  • Can you run the same Ant tasks on your development machine successfully? – Raffaele Aug 06 '14 at 10:59
  • yes its is running successfully on my machine. it start happening when i deployed the code on bibucket and integrate it with jenkins for running test automatically. – napendra Aug 06 '14 at 11:01
  • Still, it seems JUnit is not on the classpath. Try to [print it out](http://stackoverflow.com/a/16201722/315306) – Raffaele Aug 06 '14 at 11:05
  • Junit was in classpath and it was working fine on my local machine but i am not aware if we need to set again Junit classpth after pushing code to repo. and how ? i am very new to this. – napendra Aug 06 '14 at 11:08
  • I suggested you modify your build script to dump the classpath used in the compilation task, because it seems that JUnit is not there. How do you set the classpath when launching the Ant task locally? – Raffaele Aug 06 '14 at 11:11

1 Answers1

0

Check if there was any recent jdk version updates for jdk used to build the code. If you have a slave node also check the jdk version on the same.

Gautam Jose
  • 686
  • 8
  • 20