Java – spring guided the application to build the delivery locally, but failed in Jenkins due to testing

When the gradle build command is executed for XXXX app in the local system, the build is successful However, when I execute the build through the Jenkins job, the build fails when executing the spring boot application test, 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 related to build The test dependency in gradle is related, but it is uncertain whether it will succeed in the local system I use the following dependencies,

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

Can someone help solve this problem because I can't move forward in Jenkins's work?

Solution

I face the same problem As far as I am concerned, this is the problem of test failure in the old Jenkins version Before gradle testing, you need to add gradle clean

Look at the answer explanation. When do we need gradle clean

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>