Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
335 views
in Technique[技术] by (71.8m points)

spring boot - Gradle test fails on dependency without version

I have a Spring Boot application that uses JMockit for testing, from recent changes JMockit requires to pass a path to jar when it's running. When I do gradle test it fails on dependency without striictly mentioned version

plugins {
    id 'org.springframework.boot' version '2.4.2'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}
repositories {
    mavenCentral()
    maven { url 'https://repo.spring.io/milestone' }
}
ext {
    set('springCloudVersion', "2020.0.0")
}
dependencies {
    implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.jmockit:jmockit:1.49'
}
test {
    jvmArgs += ["-javaagent:${classpath.find { file -> file.name.contains("jmockit") }.absolutePatha}"]
    systemProperties System.properties
}
dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

The error I receive:

A problem occurred evaluating root project 'demo'.
> Could not resolve all files for configuration ':testRuntimeClasspath'.
   > Could not find org.springframework.cloud:spring-cloud-starter-openfeign:.
     Required by:
         project :

How can I fix it?

question from:https://stackoverflow.com/questions/65899357/gradle-test-fails-on-dependency-without-version

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

repo.spring.io was shut down less than a week ago. You need to use another maven repository.

https://spring.io/blog/2020/10/29/notice-of-permissions-changes-to-repo-spring-io-fall-and-winter-2020


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...