简体   繁体   中英

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. The message I get is: Could not find org.junit:junit-bom:5.4.0-SNAPSHOT. but in my gradle file I don't have it. 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/ :

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

But you'd better use generally available versions.

The Junit dependency comes with , it may not be available in your spring version. ,在您的spring版本中可能不可用。 Try to change the spring version or use a latest version and give it a go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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