question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid Gradle build configuration when Spring Cloud Contract is included

See original GitHub issue

As reported in spring-cloud/spring-cloud-contract gh-1795, the Gradle configuration as created by Initializer is invalid with respect to configuring the contracts extension. Presently, SpringCloudContractGradleBuildCustomizer.java#L75-L83, adds the configuration to a task with the name contracts which does not exist. This then results in build failures with the default project configuration directly provided by Initializer.

Incorrect:

tasks.named("contracts") {
    testFramework = org.springframework.cloud.contract.verifier.config.TestFramework.JUNIT5
}

Correct:

contracts {
    testFramework = org.springframework.cloud.contract.verifier.config.TestFramework.JUNIT5
}

Minimal reproducer: https://start.spring.io/#!type=gradle-project&language=java&platformVersion=2.7.0&packaging=jar&jvmVersion=17&groupId=com.example&artifactId=demo&name=demo&description=Demo project for Spring Boot&packageName=com.example.demo&dependencies=cloud-contract-verifier

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
snicollcommented, Nov 19, 2022

Yep, junit5 is the default. The error is to be expected. You need a contract.

1reaction
snicollcommented, Nov 18, 2022

@bwgjoseph It doesn’t but we should be able to generate the right bits now. I’ll try to spare some cycles to look at it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

4. Spring Cloud Contract Verifier Setup
To learn how to set up the Gradle project for Spring Cloud Contract ... Gradle Plugin setup creates the following Gradle part of...
Read more >
Generated tests fail in Spring Cloud Contract - Stack Overflow
I have a groovy file which has a post request and a response. When I do gradle build , the tests are autogenerated...
Read more >
spring-cloud/spring-cloud-contract - Gitter
configuration is for SCM, when you use GIT to store contracts and using Artifactory in this case is wrong? Marcin ...
Read more >
Better Integration Testing With Spring Cloud Contract
Producer Starter Configuration. You are creating a Java project – Java 11 – using Maven as the build system. The Spring Boot version...
Read more >
An Intro to Spring Cloud Contract - Baeldung
When we run the build, the plugin automatically generates a test class named ContractVerifierTest that extends our BaseTestClass and puts it in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found