Reputation: 2338
I looked at the sample and followed it.
(Gradle version is 6.8.3)
https://docs.gradle.org/6.8.3/samples/sample_building_java_applications_multi_project.html
I just only append plugin 'io.spring.dependency-management' at demo.java-common-conventions.gradle file.
plugins {
id 'java'
id 'io.spring.dependency-management' version '1.0.7.RELEASE' // append
}
Then run the gradle build, The following error occurred.
- What went wrong: Invalid plugin request [id: 'io.spring.dependency-management', version: '1.0.7.RELEASE']. Plugin requests from precompiled scripts must not include a version number. Please remove the version from th e offending request and make sure the module containing the requested plugin 'io.spring.dependency-management' is an implementation dependency
So I tried removing version.
Then, the following error occurred.
Plugin with id 'io.spring.dependency-management' not found.
I've tried adding a dependencies as well, but I still got a not found error.
plugins {
id 'java'
id 'io.spring.dependency-management'
}
repositories {
jcenter()
}
dependencies {
implementation "io.spring.gradle:dependency-management-plugin:1.0.7.RELEASE"
constraints {
implementation 'org.apache.commons:commons-text:1.9'
}
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}
tasks.named('test') {
useJUnitPlatform()
}
How can I solve this problem?
Upvotes: 11
Views: 2322
Reputation: 22952
The solution is in the error:
What went wrong: Invalid plugin request [id: 'io.spring.dependency-management', version: '1.0.7.RELEASE']. Plugin requests from precompiled scripts must not include a version number. Please remove the version from the offending request and make sure the module containing the requested plugin 'io.spring.dependency-management' is an implementation dependency
So demo.java-common-conventions.gradle
will look like:
plugins {
id 'java'
id 'io.spring.dependency-management'
}
Now you must add the dependency for Spring Dependency Management plugin in buildSrc/build.gradle
:
// buildSrc/build.gradle
dependencies {
implementation "io.spring.gradle:dependency-management-plugin:1.0.7.RELEASE"
}
Upvotes: 13