zoukankan      html  css  js  c++  java
  • web项目查看maven项目依赖与解决jar包冲突

    在项目中好几次出现jar包冲突的情况,想要使用idea查看依赖关系很不方便,第一是慢,第二是搜索不方便。在网络上很多都是这种办法,但今天我找到了一个更好更简洁的办法。

    1 可以在idea中右击项目

    输入mvn dependency:tree

    [INFO] Scanning for projects...
    [INFO]
    [INFO] ----< org.springframework.boot:xxl-job-executor-sample-springboot >-----
    [INFO] Building xxl-job-executor-sample-springboot 1.5.9.RELEASE
    [INFO] --------------------------------[ war ]---------------------------------
    [INFO]
    [INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ xxl-job-executor-sample-springboot ---
    [INFO] org.springframework.boot:xxl-job-executor-sample-springboot:war:1.5.9.RELEASE
    [INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.5.9.RELEASE:compile
    [INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.5.9.RELEASE:compile
    [INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.5.9.RELEASE:compile
    [INFO] |  |  - org.yaml:snakeyaml:jar:1.17:runtime
    [INFO] |  +- org.hibernate:hibernate-validator:jar:5.3.6.Final:compile
    [INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
    [INFO] |  |  - com.fasterxml:classmate:jar:1.3.4:compile
    
    ...........
    
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  7.123 s
    [INFO] Finished at: 2020-03-13T15:09:15+08:00
    [INFO] ------------------------------------------------------------------------
    
    

    上面就是jar包的依赖关系,如果想要查找某个jar包冲突,就ctr+f查找就可以。如果某个包依赖另一个jar包(A),而后者(A)与我们想要使用的jar包冲突,我们就要去除A jar包,可以使用

      <dependency>
        <groupId>com.baidu.disconf</groupId>
        <artifactId>disconf-client</artifactId>
        <version>2.6.36</version>
        <!--去除disconf中我们不需要的依赖包-->
        <exclusions>
          <exclusion>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
          </exclusion>
        </exclusions>
    </dependency>
    

    2 也可以直接到项目文件夹中使用cmd查看依赖包,打开项目文件夹,shift+鼠标右键

    打开cmd命令同样输入mvn dependency:tree即可。

  • 相关阅读:
    SD_WebImage-03-多线程+下载任务放入非主线程执行
    NSOperationQueue_管理NSOperation-02-多线程
    CALayer小结-基本使用00-UI进阶
    XMPP-UI进阶-01
    XMPP总结-UI进阶-00
    UI控件总结-UI初级
    转场动画-01-day4
    暂停-开始动画-核心动画-08-day4
    核心动画-04-CALayer隐式动画
    Android开发技术周报 Issue#71
  • 原文地址:https://www.cnblogs.com/sean-zeng/p/12487681.html
Copyright © 2011-2022 走看看