简体   繁体   English

Spring引导应用程序本地构建传递,但由于测试而在Jenkins中失败

[英]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. 在本地系统中为xxxx-app执行gradle build命令时,构建成功。 But When I execute the build through Jenkins job, the build gets fails when executing the Spring boot application Tests as shown below. 但是当我通过Jenkins作业执行构建时,构建在执行Spring引导应用程序测试时失败,如下所示。

: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. 我相信这与build.gradle中的测试依赖关系有关,但不确定在本地系统中是否成功。 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. 就我而言,这是旧Jenkins版本中测试失败的问题。
You will need to add gradle clean before gradle test . gradle test之前,您需要添加gradle clean

Look at this answer for explanation when do we need to do gradle clean . 看看这个答案的解释我们什么时候需要做gradle clean

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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