Reputation: 87
Hello I'm having problem to resolve dependencies when using spring dependency management plugin
I have a gradle project with subprojects and I'm using this config.
build.gradle file
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id "io.spring.dependency-management" version '1.0.11.RELEASE'
id 'org.springframework.boot' version '2.4.4'
}
apply from: './main.gradle'
main.gradle file
subprojects {
apply plugin: "java"
apply plugin: "jacoco"
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
implementation 'io.projectreactor:reactor-core'
implementation 'io.projectreactor.addons:reactor-extra'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
}
jacoco {
toolVersion = '0.8.2'
}
}
As you can see I'm trying to load some dependencies for every subproject in my project, like io.projectreactor:reactor-core
When I run a gradle refresh, I'm getting this message (for every subproject) on my intellij IDE console:
Could not resolve: org.projectlombok:lombok
Could not resolve: io.projectreactor:reactor-core
Could not resolve: io.projectreactor.addons:reactor-extra
Could not resolve: org.springframework.boot:spring-boot-starter-test
Could not resolve: io.projectreactor:reactor-test
If I put versions explicit inside dependecies block then gradle resolve without problem but I don't want that
Any ideas about this issue ? How could I validate it ?
Gradle Wrapper Version: 6.8.3 (intellij is configured to use default gradle wrapper)
Thanks for your help
Regards!
Upvotes: 0
Views: 2211
Reputation: 87
I resolved the issue, as @m-deinum suggets, I was missing spring-boot-gradle-plugin on dependencies at root project.
Thank you
Upvotes: 1
Reputation: 6391
Add 'org.springframework.boot' to the plugins
section of every submodule's build.gradle
:
plugins {
...
id 'org.springframework.boot'
}
You don't need to specify version in this case because it's already specified in the root build.gradle
Upvotes: 0