【发布时间】:2021-10-25 07:44:30
【问题描述】:
这是我的 build.gradle
buildscript {
ext {
springBootVersion = '2.1.7.REALEASE'
}
repositories {
mavenCentral()
jcenter()
}
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 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web:')
testCompile('org.springframework.boot:spring-boot-starter-test:')
}
这是同步错误消息
无法解析配置“:classpath”的所有工件。 找不到 org.springframework.boot:spring-boot-gradle-plugin:2.1.7.REALEASE。 在以下位置搜索: - https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/2.1.7.REALEASE/spring-boot-gradle-plugin-2.1.7.REALEASE.pom - https://jcenter.bintray.com/org/springframework/boot/spring-boot-gradle-plugin/2.1.7.REALEASE/spring-boot-gradle-plugin-2.1.7.REALEASE.pom 要求: 项目:
可能的解决方案:
- 声明提供工件的存储库,请参阅https://docs.gradle.org/current/userguide/declaring_repositories.html 上的文档
有明确声明的仓库,如 mavenCentral() 和 jcnenter(),但无法构建。
【问题讨论】:
-
是否可以在 IDE 之外构建命令行?
-
我在 cmd 中尝试过(使用命令“gradle build”),但仍然给我一条错误消息“FAILURE: Build failed with an exception。”
-
你是否在一个 Gradle 项目中遇到同样的问题?
标签: spring-boot gradle intellij-idea