So, I migrated my basic application from Spring Boot 1.5.10 to 2.0.0. I am using Gradle and before the migration, I always excluded version numbers of the artifacts of the compile dependencies. After the migration, gradle build task started to throw an error like this:
BUILD FAILED in 0s
2 actionable tasks: 1 executed, 1 up-to-date
During the build, one or more dependencies that were declared without a version failed to resolve:
org.springframework.boot:spring-boot-starter-data-rest:
org.springframework.boot:spring-boot-starter-web:
org.springframework.boot:spring-boot-starter-data-jpa:
Did you forget to apply the io.spring.dependency-management plugin to the llutrackr project?
My build.gradle
(I excluded the irrelevant parts):
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.RELEASE")
}
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-data-rest")
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-web')
}
After I add version numbers to the corresponding dependencies, then the problem is solved. Why is this change necessary to build Spring Boot 2.0 projects with gradle? Even spring guides don't include artifact version numbers. An example
Try adding following to your build.gradle file
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
https://docs.spring.io/spring-boot/docs/2.0.0.BUILD-SNAPSHOT/gradle-plugin/reference/html/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With