首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring引导,将依赖项排除在第5级的测试中。

Spring引导,将依赖项排除在第5级的测试中。
EN

Stack Overflow用户
提问于 2020-06-17 10:08:57
回答 1查看 552关注 0票数 0

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

代码语言:javascript
复制
dependencies {
    runtimeOnly('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client')
    runtimeOnly('org.springframework.cloud:spring-cloud-starter-config')
}

在运行测试期间,我如何明确地告诉Gradle 5不要加载这些jars?我已经禁用了他们的使用,但他们还是继续上膛。我本来希望能得到像下面这样简单的东西,但我一直找不到确切的答案。

代码语言:javascript
复制
test.exclude {
    group 'org.springframework.cloud'
}

编辑

复制糊溶液

代码语言:javascript
复制
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')
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-06-17 12:18:58

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

代码语言:javascript
复制
configurations.testCompile.exclude(group: 'the-group', module: 'the-module')

希望这能有所帮助!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62426519

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档