Dependency still on classpath after Gradle depende

2019-07-27 08:31发布

问题:

I want to remove:

"com.vaadin.external.google:androidjson:0.0.20131108.vaadin1"

from my classpath. With the dependency tree I saw that this dependency comes from:

'org.springframework.boot:spring-boot-configuration-rocessor:1.5.8.RELEASE'.

Therefore I changed it to the following:

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

My issue is that the dependency still gets pulled:

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

What am I doing wrong?

回答1:

It's likely you have a test dependency as well that needs to be excluded. Include the following in your script:

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