Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plugins problem in Gradle with Multi-project

Tags:

java

gradle

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?

like image 986
Jaime Avatar asked Mar 31 '26 19:03

Jaime


1 Answers

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"
}
like image 111
Francisco Mateo Avatar answered Apr 03 '26 09:04

Francisco Mateo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!