boden
boden

Reputation: 1681

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?

Upvotes: 1

Views: 427

Answers (1)

Erik Kristensen
Erik Kristensen

Reputation: 494

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

Upvotes: 1

Related Questions