<dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>3.1.1.RELEASE</version> <scope>runtime</scope> </dependency>
就會帶入下面這一整串的 Jar 檔:
+- org.springframework:spring-webmvc:jar:3.1.1.RELEASE:runtime +- org.springframework:spring-asm:jar:3.1.1.RELEASE:runtime +- org.springframework:spring-beans:jar:3.1.1.RELEASE:runtime +- org.springframework:spring-context:jar:3.1.1.RELEASE:runtime \- org.springframework:spring-aop:jar:3.1.1.RELEASE:runtime +- org.springframework:spring-context-support:jar:3.1.1.RELEASE:runtime +- org.springframework:spring-core:jar:3.1.1.RELEASE:runtime +- org.springframework:spring-expression:jar:3.1.1.RELEASE:runtime \- org.springframework:spring-web:jar:3.1.1.RELEASE:runtime \- aopalliance:aopalliance:jar:1.0:runtime最大的好處是,不用知道 Spring MVC 需要哪些 Jar 檔才能運作,但是小小的缺點是,有時候不知道某個 Jar 檔是被誰帶進來的,尤其是 pom.xml 定義了很多 Jar 檔時,甚至被帶進來的 Jar 檔有版本不同的問題時。
這時候就可以用 Maven 提供的 dependency:tree 指令來畫出相依樹來:
mvn dependency:tree可以得到下面這個美美的樹狀圖:
com.anvision.productCenter:ProductCenter:war:1.0-SNAPSHOT +- org.springframework:spring-webmvc:jar:3.1.1.RELEASE:runtime | +- org.springframework:spring-asm:jar:3.1.1.RELEASE:runtime | +- org.springframework:spring-beans:jar:3.1.1.RELEASE:runtime | +- org.springframework:spring-context:jar:3.1.1.RELEASE:runtime | | \- org.springframework:spring-aop:jar:3.1.1.RELEASE:runtime | +- org.springframework:spring-context-support:jar:3.1.1.RELEASE:runtime | +- org.springframework:spring-core:jar:3.1.1.RELEASE:runtime | +- org.springframework:spring-expression:jar:3.1.1.RELEASE:runtime | \- org.springframework:spring-web:jar:3.1.1.RELEASE:runtime | \- aopalliance:aopalliance:jar:1.0:runtime +- javax.servlet:jstl:jar:1.2:compile +- org.apache.tiles:tiles-jsp:jar:2.2.2:compile | +- org.apache.tiles:tiles-servlet:jar:2.2.2:compile | | \- org.apache.tiles:tiles-core:jar:2.2.2:compile | | \- commons-digester:commons-digester:jar:2.0:compile | | \- commons-beanutils:commons-beanutils:jar:1.8.0:compile | \- org.apache.tiles:tiles-template:jar:2.2.2:compile | \- org.apache.tiles:tiles-api:jar:2.2.2:compile +- org.slf4j:jcl-over-slf4j:jar:1.6.1:runtime (scope not updated to compile) +- org.slf4j:slf4j-api:jar:1.6.1:runtime (scope not updated to compile) +- org.slf4j:slf4j-jdk14:jar:1.6.1:runtime +- commons-lang:commons-lang:jar:2.6:compile +- org.jsoup:jsoup:jar:1.5.2:runtime +- commons-io:commons-io:jar:2.0.1:runtime +- org.codehaus.jackson:jackson-mapper-asl:jar:1.7.3:runtime +- org.codehaus.jackson:jackson-core-asl:jar:1.7.3:runtime +- commons-collections:commons-collections:jar:3.2.1:runtime +- commons-fileupload:commons-fileupload:jar:1.2.2:runtime +- javax.validation:validation-api:jar:1.0.0.GA:compile +- org.hibernate:hibernate-validator:jar:4.0.2.GA:compile | +- javax.xml.bind:jaxb-api:jar:2.1:compile | | +- javax.xml.stream:stax-api:jar:1.0-2:compile | | \- javax.activation:activation:jar:1.1:compile | \- com.sun.xml.bind:jaxb-impl:jar:2.1.3:compile +- net.sourceforge.javacsv:javacsv:jar:2.0:compile +- net.sourceforge.jexcelapi:jxl:jar:2.6.12:compile \- javax.annotation:jsr250-api:jar:1.0:compile也可以輸出到檔案裡好好欣賞:
mvn dependency:tree -DoutputFile=<File_Path>dependency:tree 完整的文件在這。
沒有留言:
張貼留言