5

When executing gradle build command in local system for xxxx-app, the build is successful. But When I execute the build through Jenkins job, the build gets fails when executing the Spring boot application Tests as shown below.

:xxxx-app:processTestResources UP-TO-DATE
:xxxx-app:testClasses
:xxxx-app:test

com.xxxx.yyyy.XXXXApplicationTests > contextLoads FAILED
java.lang.IllegalStateException
Caused by: org.springframework.beans.factory.BeanCreationException
Caused by: org.springframework.beans.factory.BeanCreationException
Caused by: java.lang.IllegalArgumentException

1 test completed, 1 failed
:xxxx-app:test FAILED

FAILURE: Build failed with an exception.

I believe this is something to do with test dependencies in build.gradle, But not sure the same is getting successful in local system. I am using below dependency,

testCompile('org.springframework.boot:spring-boot-starter-test')

Can some one help on this issue due to this I could not proceed further in Jenkins job?

user7886451
  • 51
  • 1
  • 2

1 Answers1

0

I was facing the same issue. In my case, it was an issue with test failures in old Jenkins builds.
You will need to add gradle clean before gradle test.

Look at this answer for explanation when do we need to do gradle clean.

Ivan Aracki
  • 4,861
  • 11
  • 59
  • 73