Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dependencies are failed to resolve when migrated from Spring Boot 1.5.10 to 2.0.0

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

like image 867
leventunver Avatar asked Mar 03 '18 12:03

leventunver


1 Answers

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/

like image 138
miskender Avatar answered Oct 22 '22 18:10

miskender