-
Notifications
You must be signed in to change notification settings - Fork 879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid Gradle build configuration when Spring Cloud Contract is included #938
Comments
From the linked issue |
Yeah, that's probably the case. I would think adding an |
spring-io/initializr#1079 touches on the need for this. |
@wilkinsona does your fix in #1079 resolve this? |
@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. |
So I am now generating this locally:
Which fails with
A Maven-based project doesn't fail the same way so I am not keen to proceed. If anyone can help crafting the correct build definition, that would be helpful. cc @marcingrzejszczak |
just write
|
I don't think that's right. I don't have to do that with Maven. Should we ignore the fact there isn't a contract? |
With the help of Marcin, creating a |
Thanks @snicoll. I just went to try at plugins {
id 'java'
id 'org.springframework.boot' version '2.7.5'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'org.springframework.cloud.contract' version '3.1.5'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
repositories {
mavenCentral()
}
ext {
set('springCloudVersion', "2021.0.5")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
tasks.named('contractTest') {
useJUnitPlatform()
}
tasks.named('test') {
useJUnitPlatform()
}
contracts {
} Does that mean that I saw that in the docs that
I couldn't find any other mention of I also went to download new project generated by start.spring and wasn't able to build the project
|
Yep, junit5 is the default. The error is to be expected. You need a contract. |
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 namecontracts
which does not exist. This then results in build failures with the default project configuration directly provided by Initializer.Incorrect:
Correct:
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%20project%20for%20Spring%20Boot&packageName=com.example.demo&dependencies=cloud-contract-verifier
The text was updated successfully, but these errors were encountered: