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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…