[英]Why do I get Gradle configure build error junit5 in IntelliJ?
我使用Spring Boot初始化程序創建了干凈的項目,但出現配置生成錯誤。 我得到的消息是: Could not find org.junit:junit-bom:5.4.0-SNAPSHOT.
但是在我的gradle文件中我沒有。 它出什么問題了?
buildscript {
ext {
springBootVersion = '2.2.0.BUILD-SNAPSHOT'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 11
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-security')
implementation('org.springframework.boot:spring-boot-starter-web')
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation('org.springframework.security:spring-security-test')
}
您正在使用Spring Boot的開發(快照)版本,該版本引用JUnit 5的開發(快照)版本,但尚未添加JUnit的快照存儲庫: https : //oss.sonatype.org/content/repositories/snapshots /org/junit/junit-bom/5.4.0-SNAPSHOT/ :
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
但是您最好使用一般可用的版本。
Junit依賴項帶有“ spring-boot-starter-test” ,在您的spring版本中可能不可用。 嘗試更改春季版本或使用最新版本,然后嘗試一下。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.