【问题标题】:Dependency still on classpath after Gradle dependency exclusionGradle 依赖项排除后,依赖项仍在类路径上
【发布时间】:2018-04-06 23:11:01
【问题描述】:

我要删除:

“com.vaadin.external.google:androidjson:0.0.20131108.vaadin1”

来自我的类​​路径。通过依赖树,我看到这个依赖来自:

'org.springframework.boot:spring-boot-configuration-processesor:1.5.8.RELEASE'。

因此我将其更改为以下内容:

compile ('org.springframework.boot:spring-boot-configuration-processor:1.5.8.RELEASE'){
    exclude group: 'com.vaadin.external.google', module: 'android-json'
}

我的问题是依赖项仍然被拉取:

...
+--- org.springframework.boot:spring-boot-configuration-processor:1.5.8.RELEASE
|    \--- com.vaadin.external.google:android-json:0.0.20131108.vaadin1
...

我做错了什么?

【问题讨论】:

  • 在测试编译依赖项也引入依赖项之前,我遇到过这个问题: testCompile("org.springframework.boot:spring-boot-starter-test") { exclude group : 'com.vaadin.external.google', module: 'android-json'} 如果添加可以解决问题,请告诉我。
  • 谢谢,问题已解决。你是怎么想出来的。有趣的是,在运行人工制品时,这种依赖关系仍在类路径中。
  • 如果我没记错的话,我有一个非常大的依赖树,我开始通过专注于编译来缩小它,然后使用命令gradle dependencies --configuration [compile|testCompile] 进行测试编译。那时我碰巧注意到带有测试编译依赖项的 vaadin。但不确定它是否在完整的报告中。

标签: java spring spring-mvc spring-boot gradle


【解决方案1】:

您可能还有需要排除的测试依赖项。在脚本中包含以下内容:

testCompile("org.springframework.boot:spring-boot-starter-te‌​st") { 
    exclude group: 'com.vaadin.external.google', module: 'android-json
'}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-08
    • 2016-05-04
    • 1970-01-01
    • 2020-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多