Maven查看包依赖

发现org.slf4j:slf4j-log4j12:jar会导致SpringBoot无法启动,需要找出是那个jar加载了它。执行命令mvn dependency:tree

在输出的依赖树里找到

[INFO] +- com.alibaba.boot:dubbo-spring-boot-starter:jar:0.1.2.RELEASE:compile
[INFO] |  +- com.alibaba:dubbo:jar:2.6.5:compile
[INFO] |  |  +- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] |  |  \- org.jboss.netty:netty:jar:3.2.5.Final:compile
[INFO] |  +- org.apache.zookeeper:zookeeper:jar:3.4.9:compile
[INFO] |  |  +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] |  |  +- log4j:log4j:jar:1.2.16:compile
[INFO] |  |  +- jline:jline:jar:0.9.94:compile
[INFO] |  |  \- io.netty:netty:jar:3.10.5.Final:compile

原来是ZooKeeper依赖了该jar,需要排除

        
        <dependency>
            <groupId>com.alibaba.bootgroupId>
            <artifactId>dubbo-spring-boot-starterartifactId>
            <version>${dubbo.version}version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4jgroupId>
                    <artifactId>slf4j-log4j12artifactId>
                exclusion>
            exclusions>
        dependency>

谢谢阅读!

你可能感兴趣的:(Maven查看包依赖)