【发布时间】:2020-02-14 18:02:56
【问题描述】:
我使用一些依赖项从Spring 创建了一个名为test-jdbc-demo 的演示Gradle 项目,并且没有进行任何更改,只是使用Open -> build.gradle 文件在Intellij 上解压缩并导入,并尝试使用默认Intellij 中的Import窗户。导入时,项目未构建,并且出现有关 gradle 依赖项的错误。我在 Ubuntu 上使用 Intellij 2019.3、JDK 1.8。
错误
FAILURE: Build failed with an exception.
* Where:
Build file '/home/augusto.cadini/projects/Spring Applications/test-jdbc-demo/build.gradle' line: 2
* What went wrong:
Plugin [id: 'org.springframework.boot', version: '2.2.4.RELEASE'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.2.4.RELEASE')
Searched in the following repositories:
Gradle Central Plugin Repository
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
CONFIGURE FAILED in 208ms
build.gradle
plugins {
id 'org.springframework.boot' version '2.2.4.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
}
group = 'com.jdbc'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
【问题讨论】:
-
它是从命令行构建的吗?
./gradlew clean build
标签: java spring gradle intellij-idea