为了账号安全,请及时绑定邮箱和手机立即绑定

Gradle 无法解析 Spring Boot HATEOAS 依赖项

Gradle 无法解析 Spring Boot HATEOAS 依赖项

元芳怎么了 2021-08-04 16:03:59
我从http://start.spring.io创建了我的骨架项目。但是当我构建应用程序时,Gradle 无法解析 HATEOAS 依赖项。这是我得到的错误:错误:java: Illegal char <:> at index 78: C:\Users\TempUser\Downloads\hateoas\Could not resolve org.springframework.boot:spring-boot-starter-hateoas:2.0.4.RELEASE。这是我的build.gradle文件:buildscript {    ext {        springBootVersion = '2.0.4.RELEASE'    }    repositories {        mavenCentral()    }    dependencies {        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")    }}apply plugin: 'java'apply plugin: 'eclipse'apply plugin: 'org.springframework.boot'apply plugin: 'io.spring.dependency-management'group = 'com.example'version = '0.0.1-SNAPSHOT'sourceCompatibility = 1.8repositories {    mavenCentral()}dependencies {    compile('org.springframework.boot:spring-boot-starter-data-jpa')    compile('org.springframework.boot:spring-boot-starter-hateoas:2.0.4.RELEASE')    compile('org.springframework.boot:spring-boot-starter-web')    testCompile('org.springframework.boot:spring-boot-starter-test')}
查看完整描述

2 回答

?
慕的地10843

TA贡献1785条经验 获得超8个赞

本声明

compile('org.springframework.boot:spring-boot-starter-hateoas:2.0.4.RELEASE')

导致错误。改成

compile('org.springframework.boot:spring-boot-starter-hateoas')

这就是引擎盖下的东西

//img1.sycdn.imooc.com//610a4a0a0001834611200604.jpg

查看完整回答
反对 回复 2021-08-04
?
MYYA

TA贡献1868条经验 获得超4个赞

您已经在此处指定了 Spring Boot 组件的版本:


ext {

    springBootVersion = '2.0.4.RELEASE'

}

因此,必须在没有版本值的情况下指定所有启动器依赖项。采用:


compile('org.springframework.boot:spring-boot-starter-hateoas')

代替


compile('org.springframework.boot:spring-boot-starter-hateoas:2.0.4.RELEASE')

希望这可以帮助


查看完整回答
反对 回复 2021-08-04
  • 2 回答
  • 0 关注
  • 285 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信