Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot Spring启动,从Gradle 5中的测试中排除依赖项_Spring Boot_Gradle_Build.gradle - Fatal编程技术网

Spring boot Spring启动,从Gradle 5中的测试中排除依赖项

Spring boot Spring启动,从Gradle 5中的测试中排除依赖项,spring-boot,gradle,build.gradle,Spring Boot,Gradle,Build.gradle,我想从测试中排除两个JAR,并且只在应用程序实际运行时使用它们 dependencies { runtimeOnly('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client') runtimeOnly('org.springframework.cloud:spring-cloud-starter-config') } 我如何明确地告诉Gradle 5在测试运行期间不要加载这些JAR?我已经禁用了

我想从测试中排除两个JAR,并且只在应用程序实际运行时使用它们

dependencies {
    runtimeOnly('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client')
    runtimeOnly('org.springframework.cloud:spring-cloud-starter-config')
}
我如何明确地告诉Gradle 5在测试运行期间不要加载这些JAR?我已经禁用了它们的使用,但它们仍然在加载。我希望得到下面这样简单的答案,但我一直无法找到一个结论性的答案

test.exclude {
    group 'org.springframework.cloud'
}
编辑

复制粘贴溶液

configurations.testCompile.exclude(group: 'org.springframework.cloud', module: 'spring-cloud-starter-netflix-eureka-client')
configurations.testCompile.exclude(group: 'org.springframework.cloud', module: 'spring-cloud-starter-config')

依赖项块中,可以执行以下操作:

configurations.testCompile.exclude(group: 'the-group', module: 'the-module')

希望这有帮助

工作出色,易于维护