Spring boot Spring启动,从Gradle 5中的测试中排除依赖项
我想从测试中排除两个JAR,并且只在应用程序实际运行时使用它们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?我已经禁用了
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')
希望这有帮助 工作出色,易于维护