代码之家  ›  专栏  ›  技术社区  ›  Menelaos

未排除Maven临时依赖项(library/jar vaadin json)

  •  1
  • Menelaos  · 技术社区  · 6 年前

    org.json 来自两个不同依赖项的包。

    <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
            </dependency>
    

    但我也有以下输出( ):

    [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.0.3.RELEASE:test
    

    依赖关系树显示以下两个条目:

    [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.0.3.RELEASE:test
    [INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.0.3.RELEASE:test
    [INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.0.3.RELEASE:test
    [INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:test
    [INFO] |  |  \- net.minidev:json-smart:jar:2.3:test
    [INFO] |  |     \- net.minidev:accessors-smart:jar:1.2:test
    [INFO] |  +- junit:junit:jar:4.12:test
    [INFO] |  +- org.assertj:assertj-core:jar:3.9.1:test
    [INFO] |  +- org.mockito:mockito-core:jar:2.15.0:test
    [INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.7.11:compile
    [INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.7.11:test
    [INFO] |  |  \- org.objenesis:objenesis:jar:2.6:test
    [INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
    [INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
    [INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
    [INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:runtime
    

    [INFO] +- org.json:json:jar:20171018:compile
    

    我尝试了以下方法,但恼人的vaadin jar仍然包含在项目中:

    <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.mbak.test</groupId>
                <artifactId>mb-cloud-starter-test</artifactId>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>com.vaadin.external.google</groupId>
                        <artifactId>android-json</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    

    这将导致“找不到方法”异常。

    更新

    下面是完整的堆栈跟踪:

    [INFO] --- maven-dependency-plugin:3.0.2:tree (default-cli) @ mb-doc-tools ---
    [INFO] Verbose not supported since maven-dependency-plugin 3.0
    [INFO] org.mbak.menios:mb-doc-tools:war:0.0.1-SNAPSHOT
    [INFO] +- org.mbak.mb.meniosapp:mb-cloud-starter:jar:2.0.6.19-SNAPSHOT:compile
    [INFO] |  +- org.mbak.mb.meniosapp:mb-masc:jar:0.0.0-SNAPSHOT:compile
    [INFO] |  |  +- com.fasterxml.jackson.core:jackson-core:jar:2.9.6:compile
    [INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
    [INFO] |  |  +- de.escalon.hypermedia:hydra-spring:jar:0.3.1:compile
    [INFO] |  |  |  +- de.escalon.hypermedia:hydra-jsonld:jar:0.3.1:compile
    [INFO] |  |  |  |  \- de.escalon.hypermedia:hydra-commons:jar:0.3.1:compile
    [INFO] |  |  |  +- de.escalon.hypermedia:spring-hateoas-ext:jar:0.3.1:compile
    [INFO] |  |  |  |  \- com.damnhandy:handy-uri-templates:jar:2.1.4:compile
    [INFO] |  |  |  \- com.github.jsonld-java:jsonld-java:jar:0.5.1:compile
    [INFO] |  |  |     +- org.apache.httpcomponents:httpclient-cache:jar:4.5.6:compile
    [INFO] |  |  |     \- org.slf4j:jcl-over-slf4j:jar:1.7.25:runtime
    [INFO] |  |  \- org.springframework.hateoas:spring-hateoas:jar:0.25.0.RELEASE:compile
    [INFO] |  +- org.springframework.data:spring-data-commons:jar:2.0.8.RELEASE:compile
    [INFO] |  |  \- org.springframework:spring-beans:jar:5.0.7.RELEASE:compile
    [INFO] |  +- org.springframework.boot:spring-boot-properties-migrator:jar:2.0.5.RELEASE:runtime
    [INFO] |  |  \- org.springframework.boot:spring-boot-configuration-metadata:jar:2.0.5.RELEASE:runtime
    [INFO] |  +- org.jolokia:jolokia-core:jar:1.5.0:compile
    [INFO] |  |  \- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
    [INFO] |  +- org.springframework.cloud:spring-cloud-starter-config:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- org.springframework.cloud:spring-cloud-starter:jar:2.0.0.RELEASE:compile
    [INFO] |  |  |  +- org.springframework.cloud:spring-cloud-context:jar:2.0.0.RELEASE:compile
    [INFO] |  |  |  \- org.springframework.security:spring-security-rsa:jar:1.0.5.RELEASE:compile
    [INFO] |  |  |     \- org.bouncycastle:bcpkix-jdk15on:jar:1.56:compile
    [INFO] |  |  |        \- org.bouncycastle:bcprov-jdk15on:jar:1.56:compile
    [INFO] |  |  \- org.springframework.cloud:spring-cloud-config-client:jar:2.0.0.RELEASE:compile
    [INFO] |  +- org.springframework.cloud:spring-cloud-commons:jar:2.0.0.RELEASE:compile
    [INFO] |  |  \- org.springframework.security:spring-security-crypto:jar:5.0.6.RELEASE:compile
    [INFO] |  +- org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- org.springframework.cloud:spring-cloud-netflix-core:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- org.springframework.cloud:spring-cloud-netflix-eureka-client:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- com.netflix.eureka:eureka-client:jar:1.9.2:compile
    [INFO] |  |  |  +- org.codehaus.jettison:jettison:jar:1.3.7:runtime
    [INFO] |  |  |  |  \- stax:stax-api:jar:1.0.1:runtime
    [INFO] |  |  |  +- com.netflix.netflix-commons:netflix-eventbus:jar:0.3.0:runtime
    [INFO] |  |  |  |  +- com.netflix.netflix-commons:netflix-appix:jar:0.3.0:runtime
    [INFO] |  |  |  |  |  +- commons-jxpath:commons-jxpath:jar:1.3:runtime
    [INFO] |  |  |  |  |  \- org.antlr:antlr-runtime:jar:3.4:runtime
    [INFO] |  |  |  |  |     +- org.antlr:stringtemplate:jar:3.2.1:runtime
    [INFO] |  |  |  |  |     \- antlr:antlr:jar:2.7.7:runtime
    [INFO] |  |  |  |  \- org.apache.commons:commons-math:jar:2.2:runtime
    [INFO] |  |  |  +- com.netflix.archaius:archaius-core:jar:0.7.6:compile
    [INFO] |  |  |  +- javax.ws.rs:jsr311-api:jar:1.1.1:runtime
    [INFO] |  |  |  +- com.netflix.servo:servo-core:jar:0.12.21:runtime
    [INFO] |  |  |  +- com.sun.jersey:jersey-core:jar:1.19.1:runtime
    [INFO] |  |  |  +- com.sun.jersey:jersey-client:jar:1.19.1:runtime
    [INFO] |  |  |  +- com.sun.jersey.contribs:jersey-apache-client4:jar:1.19.1:runtime
    [INFO] |  |  |  +- com.google.inject:guice:jar:4.1.0:runtime
    [INFO] |  |  |  |  \- aopalliance:aopalliance:jar:1.0:runtime
    [INFO] |  |  |  \- com.github.vlsi.compactmap:compactmap:jar:1.2.1:runtime
    [INFO] |  |  |     \- com.github.andrewoma.dexx:dexx-collections:jar:0.2:runtime
    [INFO] |  |  +- com.netflix.eureka:eureka-core:jar:1.9.2:compile
    [INFO] |  |  |  \- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:runtime
    [INFO] |  |  |     +- javax.xml.stream:stax-api:jar:1.0-2:runtime
    [INFO] |  |  |     \- org.codehaus.woodstox:stax2-api:jar:3.1.4:runtime
    [INFO] |  |  +- org.springframework.cloud:spring-cloud-starter-netflix-archaius:jar:2.0.0.RELEASE:compile
    [INFO] |  |  |  +- org.springframework.cloud:spring-cloud-netflix-archaius:jar:2.0.0.RELEASE:compile
    [INFO] |  |  |  \- commons-configuration:commons-configuration:jar:1.8:compile
    [INFO] |  |  \- com.netflix.ribbon:ribbon-eureka:jar:2.2.5:compile
    [INFO] |  +- org.springframework.cloud:spring-cloud-starter-netflix-zuul:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- org.springframework.cloud:spring-cloud-netflix-zuul:jar:2.0.0.RELEASE:compile
    [INFO] |  |  |  \- com.netflix.netflix-commons:netflix-commons-util:jar:0.3.0:compile
    [INFO] |  |  +- org.springframework.cloud:spring-cloud-starter-netflix-hystrix:jar:2.0.0.RELEASE:compile
    [INFO] |  |  |  +- com.netflix.hystrix:hystrix-core:jar:1.5.12:compile
    [INFO] |  |  |  +- com.netflix.hystrix:hystrix-serialization:jar:1.5.12:compile
    [INFO] |  |  |  |  \- com.fasterxml.jackson.module:jackson-module-afterburner:jar:2.9.6:runtime
    [INFO] |  |  |  +- com.netflix.hystrix:hystrix-metrics-event-stream:jar:1.5.12:compile
    [INFO] |  |  |  +- com.netflix.hystrix:hystrix-javanica:jar:1.5.12:compile
    [INFO] |  |  |  |  \- org.ow2.asm:asm:jar:5.0.4:runtime
    [INFO] |  |  |  \- io.reactivex:rxjava-reactive-streams:jar:1.2.1:compile
    [INFO] |  |  |     \- org.reactivestreams:reactive-streams:jar:1.0.2:runtime
    [INFO] |  |  \- com.netflix.zuul:zuul-core:jar:1.3.1:compile
    [INFO] |  +- org.springframework.cloud:spring-cloud-starter-netflix-ribbon:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- org.springframework.cloud:spring-cloud-netflix-ribbon:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- com.netflix.ribbon:ribbon:jar:2.2.5:compile
    [INFO] |  |  |  +- com.netflix.ribbon:ribbon-transport:jar:2.2.5:runtime
    [INFO] |  |  |  |  +- io.reactivex:rxnetty-contexts:jar:0.4.9:runtime
    [INFO] |  |  |  |  \- io.reactivex:rxnetty-servo:jar:0.4.9:runtime
    [INFO] |  |  |  +- javax.inject:javax.inject:jar:1:runtime
    [INFO] |  |  |  \- io.reactivex:rxnetty:jar:0.4.9:runtime
    [INFO] |  |  |     +- io.netty:netty-codec-http:jar:4.1.25.Final:runtime
    [INFO] |  |  |     |  \- io.netty:netty-codec:jar:4.1.25.Final:runtime
    [INFO] |  |  |     \- io.netty:netty-transport-native-epoll:jar:4.1.25.Final:runtime
    [INFO] |  |  |        +- io.netty:netty-common:jar:4.1.25.Final:runtime
    [INFO] |  |  |        +- io.netty:netty-buffer:jar:4.1.25.Final:runtime
    [INFO] |  |  |        +- io.netty:netty-transport-native-unix-common:jar:4.1.25.Final:runtime
    [INFO] |  |  |        \- io.netty:netty-transport:jar:4.1.25.Final:runtime
    [INFO] |  |  |           \- io.netty:netty-resolver:jar:4.1.25.Final:runtime
    [INFO] |  |  +- com.netflix.ribbon:ribbon-core:jar:2.2.5:compile
    [INFO] |  |  |  \- commons-lang:commons-lang:jar:2.6:compile
    [INFO] |  |  +- com.netflix.ribbon:ribbon-httpclient:jar:2.2.5:compile
    [INFO] |  |  +- com.netflix.ribbon:ribbon-loadbalancer:jar:2.2.5:compile
    [INFO] |  |  |  \- com.netflix.netflix-commons:netflix-statistics:jar:0.1.1:runtime
    [INFO] |  |  \- io.reactivex:rxjava:jar:1.3.8:compile
    [INFO] |  +- org.springframework.cloud:spring-cloud-starter-openfeign:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- org.springframework.cloud:spring-cloud-openfeign-core:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- io.github.openfeign:feign-core:jar:9.5.1:compile
    [INFO] |  |  +- io.github.openfeign:feign-slf4j:jar:9.5.1:compile
    [INFO] |  |  +- io.github.openfeign:feign-hystrix:jar:9.5.1:compile
    [INFO] |  |  \- io.github.openfeign:feign-java8:jar:9.5.1:compile
    [INFO] |  +- org.springframework.cloud:spring-cloud-starter-ribbon:jar:1.4.5.RELEASE:compile
    [INFO] |  +- org.springframework.cloud:spring-cloud-starter-hystrix:jar:1.4.5.RELEASE:compile
    [INFO] |  +- io.github.openfeign.form:feign-form:jar:3.3.0:compile
    [INFO] |  |  \- com.google.code.findbugs:annotations:jar:3.0.1:compile
    [INFO] |  |     \- net.jcip:jcip-annotations:jar:1.0:compile
    [INFO] |  +- io.github.openfeign.form:feign-form-spring:jar:3.3.0:compile
    [INFO] |  |  \- commons-fileupload:commons-fileupload:jar:1.3.3:compile
    [INFO] |  +- com.keyholesoftware:khs-spring-boot-troublemaker-starter:jar:1.0.0:compile
    [INFO] |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.6:compile
    [INFO] |  +- ch.qos.logback:logback-core:jar:1.2.3:compile
    [INFO] |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
    [INFO] |  +- net.logstash.logback:logstash-logback-encoder:jar:4.11:compile
    [INFO] |  +- ch.qos.logback:logback-access:jar:1.2.3:compile
    [INFO] |  +- commons-io:commons-io:jar:2.6:compile
    [INFO] |  +- org.springframework.cloud:spring-cloud-starter-sleuth:jar:2.0.0.RELEASE:compile
    [INFO] |  |  +- org.springframework.boot:spring-boot-starter-aop:jar:2.0.5.RELEASE:compile
    [INFO] |  |  |  \- org.aspectj:aspectjweaver:jar:1.8.13:compile
    [INFO] |  |  \- org.springframework.cloud:spring-cloud-sleuth-core:jar:2.0.0.RELEASE:compile
    [INFO] |  |     +- org.aspectj:aspectjrt:jar:1.8.13:compile
    [INFO] |  |     +- io.zipkin.brave:brave:jar:5.1.0:compile
    [INFO] |  |     +- io.zipkin.brave:brave-context-log4j2:jar:5.1.0:compile
    [INFO] |  |     +- io.zipkin.brave:brave-instrumentation-spring-web:jar:5.1.0:compile
    [INFO] |  |     |  \- io.zipkin.brave:brave-instrumentation-http:jar:5.1.0:compile
    [INFO] |  |     +- io.zipkin.brave:brave-instrumentation-spring-rabbit:jar:5.1.0:compile
    [INFO] |  |     +- io.zipkin.brave:brave-instrumentation-kafka-clients:jar:5.1.0:compile
    [INFO] |  |     +- io.zipkin.brave:brave-instrumentation-httpclient:jar:5.1.0:compile
    [INFO] |  |     +- io.zipkin.brave:brave-instrumentation-httpasyncclient:jar:5.1.0:compile
    [INFO] |  |     \- io.zipkin.brave:brave-instrumentation-spring-webmvc:jar:5.1.0:compile
    [INFO] |  |        \- io.zipkin.brave:brave-instrumentation-servlet:jar:5.1.0:compile
    [INFO] |  +- org.springframework.cloud:spring-cloud-starter-zipkin:jar:2.0.0.RELEASE:compile
    [INFO] |  |  \- org.springframework.cloud:spring-cloud-sleuth-zipkin:jar:2.0.0.RELEASE:compile
    [INFO] |  |     +- io.zipkin.zipkin2:zipkin:jar:2.9.3:compile
    [INFO] |  |     +- io.zipkin.reporter2:zipkin-reporter:jar:2.7.3:compile
    [INFO] |  |     +- io.zipkin.reporter2:zipkin-sender-kafka11:jar:2.7.3:compile
    [INFO] |  |     \- io.zipkin.reporter2:zipkin-sender-amqp-client:jar:2.7.3:compile
    [INFO] |  +- io.micrometer:micrometer-core:jar:1.0.6:compile
    [INFO] |  |  +- org.hdrhistogram:HdrHistogram:jar:2.1.10:compile
    [INFO] |  |  \- org.latencyutils:LatencyUtils:jar:2.0.3:compile
    [INFO] |  +- io.micrometer:micrometer-registry-prometheus:jar:1.0.6:compile
    [INFO] |  |  \- io.prometheus:simpleclient_common:jar:0.4.0:compile
    [INFO] |  |     \- io.prometheus:simpleclient:jar:0.4.0:compile
    [INFO] |  +- org.togglz:togglz-spring-boot-starter:jar:2.7.0-SNAPSHOT:compile
    [INFO] |  |  \- org.togglz:togglz-spring-boot-autoconfigure:jar:2.7.0-SNAPSHOT:compile
    [INFO] |  |     +- org.togglz:togglz-core:jar:2.7.0-SNAPSHOT:compile
    [INFO] |  |     +- org.togglz:togglz-spring-core:jar:2.7.0-SNAPSHOT:compile
    [INFO] |  |     \- org.togglz:togglz-spring-web:jar:2.7.0-SNAPSHOT:compile
    [INFO] |  +- org.togglz:togglz-console:jar:2.7.0-SNAPSHOT:compile
    [INFO] |  |  \- org.togglz:togglz-servlet:jar:2.7.0-SNAPSHOT:compile
    [INFO] |  \- io.github.anand1st:sshd-shell-spring-boot-starter:jar:2.5:compile
    [INFO] |     +- org.apache.sshd:sshd-core:jar:1.6.0:compile
    [INFO] |     +- org.jline:jline-reader:jar:3.5.1:compile
    [INFO] |     |  \- org.jline:jline-terminal:jar:3.5.1:compile
    [INFO] |     \- org.jline:jline-builtins:jar:3.5.1:compile
    [INFO] +- com.google.code.gson:gson:jar:2.8.5:compile
    [INFO] +- org.mbak.mb.meniosapp:mb-cloud-starter-test:jar:2.0.0-SNAPSHOT:test
    [INFO] +- com.aspose:aspose-cells:jar:8.8.2:compile
    [INFO] +- com.aspose.pdf:aspose-pdf-jdk16:jar:9.3.1.0:compile
    [INFO] +- com.thoughtworks.xstream:xstream:jar:1.4.10:compile
    [INFO] |  +- xmlpull:xmlpull:jar:1.1.3.1:compile
    [INFO] |  \- xpp3:xpp3_min:jar:1.1.4c:compile
    [INFO] +- com.stanfy:gson-xml-java:jar:0.1.7:compile
    [INFO] +- org.json:json:jar:20171018:compile
    [INFO] +- com.aspose:aspose-words:jar:jdk16:16.8.0:compile
    [INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.0.5.RELEASE:compile
    [INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.0.5.RELEASE:compile
    [INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.0.5.RELEASE:compile
    [INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.10.0:compile
    [INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.10.0:compile
    [INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
    [INFO] |  |  +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
    [INFO] |  |  \- org.yaml:snakeyaml:jar:1.19:runtime
    [INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.0.5.RELEASE:compile
    [INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.6:compile
    [INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.6:compile
    [INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.0.5.RELEASE:compile
    [INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.34:compile
    [INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.34:compile
    [INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.34:compile
    [INFO] |  +- org.hibernate.validator:hibernate-validator:jar:6.0.12.Final:compile
    [INFO] |  |  +- javax.validation:validation-api:jar:2.0.1.Final:compile
    [INFO] |  |  \- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
    [INFO] |  +- org.springframework:spring-web:jar:5.0.7.RELEASE:compile
    [INFO] |  \- org.springframework:spring-webmvc:jar:5.0.7.RELEASE:compile
    [INFO] |     +- org.springframework:spring-aop:jar:5.0.7.RELEASE:compile
    [INFO] |     +- org.springframework:spring-context:jar:5.0.7.RELEASE:compile
    [INFO] |     \- org.springframework:spring-expression:jar:5.0.7.RELEASE:compile
    [INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.0.5.RELEASE:compile
    [INFO] |  \- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.0.5.RELEASE:compile
    [INFO] |     \- org.springframework.boot:spring-boot-actuator:jar:2.0.5.RELEASE:compile
    [INFO] +- org.springframework.boot:spring-boot-devtools:jar:2.0.5.RELEASE:runtime
    [INFO] |  +- org.springframework.boot:spring-boot:jar:2.0.5.RELEASE:compile
    [INFO] |  \- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.5.RELEASE:compile
    [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.0.5.RELEASE:test
    [INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.0.5.RELEASE:test
    [INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.0.5.RELEASE:test
    [INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:test
    [INFO] |  |  \- net.minidev:json-smart:jar:2.3:test
    [INFO] |  |     \- net.minidev:accessors-smart:jar:1.2:test
    [INFO] |  +- junit:junit:jar:4.12:test
    [INFO] |  +- org.assertj:assertj-core:jar:3.9.1:test
    [INFO] |  +- org.mockito:mockito-core:jar:2.15.0:test
    [INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.7.11:compile
    [INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.7.11:test
    [INFO] |  |  \- org.objenesis:objenesis:jar:2.6:test
    [INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
    [INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
    [INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
    

    -这里

    [INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:runtime
    [INFO] |  +- org.springframework:spring-core:jar:5.0.9.RELEASE:compile
    [INFO] |  |  \- org.springframework:spring-jcl:jar:5.0.7.RELEASE:compile
    [INFO] |  +- org.springframework:spring-test:jar:5.0.7.RELEASE:test
    [INFO] |  \- org.xmlunit:xmlunit-core:jar:2.5.1:test
    [INFO] +- org.springframework.restdocs:spring-restdocs-mockmvc:jar:2.0.0.RELEASE:test
    [INFO] |  \- javax.servlet:javax.servlet-api:jar:3.1.0:test
    [INFO] +- io.rest-assured:rest-assured:jar:3.0.6:test
    [INFO] |  +- org.codehaus.groovy:groovy:jar:2.4.15:compile
    [INFO] |  +- org.codehaus.groovy:groovy-xml:jar:2.4.15:compile
    [INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.6:compile
    [INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.10:compile
    [INFO] |  |  \- commons-codec:commons-codec:jar:1.11:compile
    [INFO] |  +- org.apache.httpcomponents:httpmime:jar:4.5.6:test
    [INFO] |  \- org.ccil.cowan.tagsoup:tagsoup:jar:1.2.1:compile
    [INFO] +- io.rest-assured:xml-path:jar:3.0.6:compile
    [INFO] |  +- io.rest-assured:rest-assured-common:jar:3.0.6:compile
    [INFO] |  +- org.apache.commons:commons-lang3:jar:3.7:compile
    [INFO] |  \- javax.xml.bind:jaxb-api:jar:2.3.0:compile
    [INFO] +- io.rest-assured:json-path:jar:3.0.6:compile
    [INFO] |  \- org.codehaus.groovy:groovy-json:jar:2.4.15:compile
    [INFO] +- io.rest-assured:json-schema-validator:jar:3.0.6:test
    [INFO] |  \- com.github.fge:json-schema-validator:jar:2.2.6:test
    [INFO] |     +- com.google.code.findbugs:jsr305:jar:3.0.0:compile
    [INFO] |     +- joda-time:joda-time:jar:2.9.9:compile
    [INFO] |     +- com.googlecode.libphonenumber:libphonenumber:jar:6.2:test
    [INFO] |     +- com.github.fge:json-schema-core:jar:1.2.5:test
    [INFO] |     |  +- com.github.fge:uri-template:jar:0.9:test
    [INFO] |     |  |  \- com.github.fge:mmb-simple:jar:1.1:test
    [INFO] |     |  |     \- com.github.fge:btf:jar:1.2:test
    [INFO] |     |  +- com.github.fge:jackson-coreutils:jar:1.8:test
    [INFO] |     |  \- org.mozilla:rhino:jar:1.7R4:test
    [INFO] |     +- javax.mail:mailapi:jar:1.4.3:test
    [INFO] |     |  \- javax.activation:activation:jar:1.1:test
    [INFO] |     \- net.sf.jopt-simple:jopt-simple:jar:4.6:test
    [INFO] +- org.springframework.restdocs:spring-restdocs-core:jar:2.0.0.RELEASE:compile
    [INFO] |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile
    [INFO] +- org.springframework.restdocs:spring-restdocs-restassured:jar:2.0.0.RELEASE:compile
    [INFO] +- capital.scalable:spring-auto-restdocs-core:jar:1.0.11:test
    [INFO] |  +- commons-collections:commons-collections:jar:3.2.2:runtime
    [INFO] |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
    [INFO] +- io.springfox:springfox-swagger2:jar:2.8.0:compile
    [INFO] |  +- io.swagger:swagger-annotations:jar:1.5.14:compile
    [INFO] |  +- io.swagger:swagger-models:jar:1.5.14:compile
    [INFO] |  +- io.springfox:springfox-spi:jar:2.8.0:compile
    [INFO] |  |  \- io.springfox:springfox-core:jar:2.8.0:compile
    [INFO] |  +- io.springfox:springfox-schema:jar:2.8.0:compile
    [INFO] |  +- io.springfox:springfox-swagger-common:jar:2.8.0:compile
    [INFO] |  +- io.springfox:springfox-spring-web:jar:2.8.0:compile
    [INFO] |  |  \- org.reflections:reflections:jar:0.9.11:compile
    [INFO] |  |     \- org.javassist:javassist:jar:3.21.0-GA:compile
    [INFO] |  +- com.google.guava:guava:jar:20.0:compile
    [INFO] |  +- com.fasterxml:classmate:jar:1.3.4:compile
    [INFO] |  +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
    [INFO] |  +- org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile
    [INFO] |  \- org.mapstruct:mapstruct:jar:1.2.0.Final:compile
    [INFO] +- io.springfox:springfox-swagger-ui:jar:2.8.0:compile
    [INFO] \- org.projectlombok:lombok:jar:1.16.22:compile
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    

    org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.json.JSONObject.entrySet()Ljava/util/Set;
            at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1006)
            at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
            at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
            at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    

    更新

    我尝试了以下方法,但仍然没有排除瓦丁:

    <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>com.vaadin.external.google</groupId>
                        <artifactId>android-json</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    

    mvn spring-boot:run 当你运行一个打包的war文件时。

    奇怪的修理

    我的一位同事通过输入以下排除项解决了这一问题(但我不明白它为什么起作用):

    <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-configuration-processor</artifactId>
                <optional>true</optional>
                <exclusions>
                    <exclusion>
                        <groupId>com.vaadin.external.google</groupId>
                        <artifactId>android-json</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    

    有人有什么想法吗?

    相似/相同问题

    https://github.com/spring-projects/spring-boot/issues/8706

    https://github.com/spring-projects/spring-boot/issues/9248

    Dependency still on classpath after Gradle dependency exclusion

    2 回复  |  直到 6 年前
        1
  •  1
  •   Mr Nobody    6 年前

        2
  •  0
  •   Menelaos    6 年前

    我的一位同事通过输入以下排除项解决了这个问题(但我不明白它为什么起作用):

    <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-configuration-processor</artifactId>
                <optional>true</optional>
                <exclusions>
                    <exclusion>
                        <groupId>com.vaadin.external.google</groupId>
                        <artifactId>android-json</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>