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?

2
  • stack trace from the test says ? Apr 19, 2017 at 9:39
  • 1
    and btw what is the test doing ? maybe it's trying to component test the app if it starts? if so maybe is checking on 'localhost' which may be different if runs on jvm?. Apr 19, 2017 at 9:46

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.