简体   繁体   English

为什么我在IntelliJ中得到Gradle configure build error junit5?

[英]Why do I get Gradle configure build error junit5 in IntelliJ?

I created clean project with spring boot initializer and I get configure build error. 我使用Spring Boot初始化程序创建了干净的项目,但出现配置生成错误。 The message I get is: Could not find org.junit:junit-bom:5.4.0-SNAPSHOT. 我得到的消息是: Could not find org.junit:junit-bom:5.4.0-SNAPSHOT. but in my gradle file I don't have it. 但是在我的gradle文件中我没有。 What's wrong with it? 它出什么问题了?

    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')
}

You're using a development (snapshot) version of Spring Boot that refers to a development (snapshot) version of JUnit 5, but you have not added JUnit's snapshot repository: https://oss.sonatype.org/content/repositories/snapshots/org/junit/junit-bom/5.4.0-SNAPSHOT/ : 您正在使用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/" }
}

But you'd better use generally available versions. 但是您最好使用一般可用的版本。

The Junit dependency comes with "spring-boot-starter-test" , it may not be available in your spring version. Junit依赖项带有“ spring-boot-starter-test” ,在您的spring版本中可能不可用。 Try to change the spring version or use a latest version and give it a go. 尝试更改春季版本或使用最新版本,然后尝试一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM