Maven Dependency

เรื่องของเรื่องคือ อยากรู้ว่า project ที่ทำอยู่เนี่ย มี dependency อะไรบ้าง version อะไรบ้าง maven มี plug-in ที่ช่วยเรื่องนี้คือ maven-dependency-plugin วิธีใช้ก็แสนจะง่าย ใน pom ไฟล์ใส่ plug-in ลงไปแบบนี้

<build>
   <plugins>
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
         <version>2.0</version>
      </plugin>
   </plugins>
</build>

เวลาใช้ก็สั่ง

mvn dependency:list -DoutputFile=C:\out\list.txt

The following files have been resolved:
aopalliance:aopalliance:jar:1.0:compile
com.ibm.icu:icu4j:jar:2.6.1:compile
commons-codec:commons-codec:jar:1.3:compile
commons-httpclient:commons-httpclient:jar:3.1-rc1:compile
commons-logging:commons-logging:jar:1.0.4:compile
dom4j:dom4j:jar:1.6.1:compile
javax.activation:activation:jar:1.1:compile
javax.mail:mail:jar:1.4:compile
javax.servlet:servlet-api:jar:2.4:compile
jaxen:jaxen:jar:1.1.1:compile
jdom:jdom:jar:1.0:compile
junit:junit:jar:3.8.1:test
org.apache.abdera:abdera-client:jar:0.3.0-incubating:compile
org.apache.abdera:abdera-core:jar:0.3.0-incubating:compile
org.apache.abdera:abdera-i18n:jar:0.3.0-incubating:compile
org.apache.abdera:abdera-parser:jar:0.3.0-incubating:compile
org.apache.abdera:abdera-protocol:jar:0.3.0-incubating:compile
org.apache.abdera:abdera-server:jar:0.3.0-incubating:compile
org.apache.abdera:abdera-spring:jar:0.3.0-incubating:compile
org.apache.geronimo.specs:geronimo-activation_1.0.2_spec:jar:1.1:compile
org.apache.ws.commons.axiom:axiom-api:jar:1.2.5:compile
org.apache.ws.commons.axiom:axiom-impl:jar:1.2.5:compile
org.codehaus.woodstox:wstx-asl:jar:3.2.1:runtime
org.springframework:spring-beans:jar:2.0.6:compile
org.springframework:spring-context:jar:2.0.6:compile
org.springframework:spring-core:jar:2.0.6:compile
org.springframework:spring-web:jar:2.0.6:compile
stax:stax-api:jar:1.0.1:compile
xalan:xalan:jar:2.6.0:compile
xerces:xercesImpl:jar:2.6.2:compile
xerces:xmlParserAPIs:jar:2.6.2:compile
xml-apis:xml-apis:jar:1.3.03:compile
xom:xom:jar:1.0:compile

mvn dependency:tree -DoutputFile=C:\out\tree.txt


org.opencare:oclib:jar:0.0.1-SNAPSHOT
+- junit:junit:jar:3.8.1:test
+- org.apache.abdera:abdera-client:jar:0.3.0-incubating:compile
| +- org.apache.abdera:abdera-core:jar:0.3.0-incubating:compile
| | +- org.apache.abdera:abdera-i18n:jar:0.3.0-incubating:compile
| | +- org.apache.geronimo.specs:geronimo-activation_1.0.2_spec:jar:1.1:compile
| | \- commons-codec:commons-codec:jar:1.3:compile
| +- org.apache.abdera:abdera-parser:jar:0.3.0-incubating:compile
| | +- org.apache.ws.commons.axiom:axiom-api:jar:1.2.5:compile
| | | +- javax.mail:mail:jar:1.4:compile
| | | | \- javax.activation:activation:jar:1.1:compile
| | | \- xml-apis:xml-apis:jar:1.3.03:compile
| | +- org.apache.ws.commons.axiom:axiom-impl:jar:1.2.5:compile
| | +- stax:stax-api:jar:1.0.1:compile
| | +- org.codehaus.woodstox:wstx-asl:jar:3.2.1:runtime
| | \- jaxen:jaxen:jar:1.1.1:compile
| | +- dom4j:dom4j:jar:1.6.1:compile
| | +- jdom:jdom:jar:1.0:compile
| | +- xerces:xercesImpl:jar:2.6.2:compile
| | \- xom:xom:jar:1.0:compile
| | +- xerces:xmlParserAPIs:jar:2.6.2:compile
| | +- xalan:xalan:jar:2.6.0:compile
| | \- com.ibm.icu:icu4j:jar:2.6.1:compile
| +- org.apache.abdera:abdera-protocol:jar:0.3.0-incubating:compile
| \- commons-httpclient:commons-httpclient:jar:3.1-rc1:compile
| \- commons-logging:commons-logging:jar:1.0.4:compile
\- org.apache.abdera:abdera-spring:jar:0.3.0-incubating:compile
+- org.apache.abdera:abdera-server:jar:0.3.0-incubating:compile
+- javax.servlet:servlet-api:jar:2.4:compile
\- org.springframework:spring-web:jar:2.0.6:compile
+- org.springframework:spring-beans:jar:2.0.6:compile
+- org.springframework:spring-context:jar:2.0.6:compile
| \- aopalliance:aopalliance:jar:1.0:compile
\- org.springframework:spring-core:jar:2.0.6:compile

2 คิดบน “Maven Dependency

  1. Pingback: Link Meven Tutorial « Open Source Java Blog

  2. Pingback: Link maven tutorial « Open Source Java Blog

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s