Skip to content

task 'contracts' is not available in gradle plugin #1795

@bwgjoseph

Description

@bwgjoseph

Describe the bug

contracts task does not seem to exist in org.springframework.cloud.contract:3.1.3 gradle plugin

Sample

This is the full build.gradle

build.gradle - click to expand
plugins {
	id 'org.springframework.boot' version '2.7.0'
	id 'io.spring.dependency-management' version '1.0.11.RELEASE'
	id 'org.springframework.cloud.contract' version '3.1.3'
	id 'java'
}

group = 'com.bwgjoseph'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
	compileOnly {
		extendsFrom annotationProcessor
	}
}

repositories {
	mavenCentral()
}

ext {
	set('springCloudVersion', "2021.0.3")
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-web'
	compileOnly 'org.projectlombok:lombok'
	developmentOnly 'org.springframework.boot:spring-boot-devtools'
	annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
	annotationProcessor 'org.projectlombok:lombok'
	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('contracts') {
	testFramework = org.springframework.cloud.contract.verifier.config.TestFramework.JUNIT5
}

tasks.named('contractTest') {
	useJUnitPlatform()
}

tasks.named('test') {
	useJUnitPlatform()
}

Faced with this

image


I removed the contracts task and ran ./gradlew tasks and I have all these tasks but contracts is definitely not one of them.

Application tasks
-----------------
bootRun - Runs this project as a Spring Boot application.

Build tasks
-----------
assemble - Assembles the outputs of this project.
bootBuildImage - Builds an OCI image of the application using the output of the bootJar task
bootJar - Assembles an executable jar archive containing the main classes and their dependencies.
bootJarMainClassName - Resolves the name of the application's main class for the bootJar task.
bootRunMainClassName - Resolves the name of the application's main class for the bootRun task.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
contractTestClasses - Assembles contract test classes.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.

Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.

Documentation tasks
-------------------
javadoc - Generates Javadoc API documentation for the main source code.

Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'scc-provider'.
dependencies - Displays all dependencies declared in root project 'scc-provider'.
dependencyInsight - Displays the insight into a specific dependency in root project 'scc-provider'.
dependencyManagement - Displays the dependency management declared in root project 'scc-provider'.
help - Displays a help message.
javaToolchains - Displays the detected java toolchains.
outgoingVariants - Displays the outgoing variants of root project 'scc-provider'.
projects - Displays the sub-projects of root project 'scc-provider'.
properties - Displays the properties of root project 'scc-provider'.
tasks - Displays the tasks runnable from root project 'scc-provider'.

Verification tasks
------------------
check - Runs all checks.
contractTest - Runs the contract tests
copyContracts - Copies contracts to the output folder
generateClientStubs - Generate client stubs from the contracts
generateContractTests - Generate server tests from the contracts
publishStubsToScm - The generated stubs get committed to the SCM repo and pushed to origin
test - Runs the test suite.
verifierStubsJar - Creates the stubs JAR task

Was it removed from the latest plugin? Or did I configure something wrongly?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions