Maven - プロジェクトの依存関係を表示する

Maven –プロジェクトの依存関係を表示する

Mavenでは、mvn dependency:treeを使用して、プロジェクトの依存関係をツリー形式で表示できます。

1. Mavenプロジェクト

Springとlogbackの依存関係を宣言した単純なMavenプロジェクトを確認します。

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. mvn依存関係:ツリー

上記のプロジェクトの依存関係を表示する例。

ターミナル

$ 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] ------------------------------------------------------------------------

完了しました。

Note
その他の使用法と例については、Maven Dependency Pluginにアクセスしてください。