Maven - Afficher la dépendance du projet

Maven - Afficher la dépendance du projet

Dans Maven, vous pouvez utilisermvn dependency:tree pour afficher les dépendances du projet sous forme d'arborescence.

1. Projet Maven

Passez en revue un projet Maven simple, déclarez les dépendances Spring et logback.

pom.xml

    
        4.1.6.RELEASE
        1.1.3
        1.7.12
    

    

      
        org.springframework
        spring-core
        ${spring.version}
        
          
            commons-logging
            commons-logging
          
        
      

      
        org.springframework
        spring-webmvc
        ${spring.version}
      

      
        org.slf4j
        jcl-over-slf4j
        ${jcl.slf4j.version}
      

      
        ch.qos.logback
        logback-classic
        ${logback.version}
      

    

2. dépendance mvn: arbre

Exemple à afficher au-dessus des dépendances du projet.

Terminal

$ mvn dependency:tree

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building {Project Name}
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ spring-mvc-logback ---
[INFO] com.example.common:spring-mvc-logback:war:1.0-SNAPSHOT
[INFO] +- org.springframework:spring-core:jar:4.1.6.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.1.6.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.1.6.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:4.1.6.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-aop:jar:4.1.6.RELEASE:compile
[INFO] |  |     \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.springframework:spring-expression:jar:4.1.6.RELEASE:compile
[INFO] |  \- org.springframework:spring-web:jar:4.1.6.RELEASE:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO] |  \- ch.qos.logback:logback-core:jar:1.1.3:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.937 s
[INFO] Finished at: 2015-06-19T19:17:54+08:00
[INFO] Final Memory: 13M/308M
[INFO] ------------------------------------------------------------------------

Terminé.

Note
VisitezMaven Dependency Plugin pour plus d'utilisations et d'exemples.