简体   繁体   中英

Spring boot application local build passes, but fails in Jenkins due to Tests

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM