【maven】dependency插件

11 篇文章 0 订阅

项目中存在多个module时,依赖的管理和优化需要某些工具的帮助来完成,dependency插件提供几个实用的goal帮助我们来更好地完成工作。

1. dependency:analyze

该goal用来分析当前项目里面的pom文件依赖,给出相关的提示;

$ mvn dependency:analyze
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.jiangjian.learning.maven:simple-web:war:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.mortbay.jetty:maven-jetty-plugin is missing. @ com.jiangjian.learning.maven:simple-web:[unknown-version], G:\maven-practice\simplemultispring\simple-web\pom.xml, line 42, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] simple-multi-spring
[INFO] simple-model
[INFO] simple-persist
[INFO] simple-weather
[INFO] simple-command
[INFO] simple-web
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building simple-multi-spring 1.0-SNAPSHOT
[INFO] ---------------------------------------------
...忽略
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory G:\maven-practice\simplemultispring\simple-web\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ simple-web ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< maven-dependency-plugin:2.8:analyze (default-cli) < test-compile @ simple-web <<<
[INFO]
[INFO]
[INFO] --- maven-dependency-plugin:2.8:analyze (default-cli) @ simple-web ---
[WARNING] Used undeclared dependencies found:
[WARNING]    com.jiangjian.learning.maven:simple-model:jar:1.0-SNAPSHOT:compile
[WARNING] Unused declared dependencies found:
[WARNING]    org.apache.velocity:velocity:jar:1.5:compile
[WARNING]    junit:junit:jar:3.8.1:test
[WARNING]    log4j:log4j:jar:1.2.12:compile
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] simple-multi-spring ................................ SUCCESS [  0.557 s]
[INFO] simple-model ....................................... SUCCESS [  0.362 s]
[INFO] simple-persist ..................................... SUCCESS [  1.004 s]
[INFO] simple-weather ..................................... SUCCESS [  0.871 s]
[INFO] simple-command ..................................... SUCCESS [  0.025 s]
[INFO] simple-web ......................................... SUCCESS [  0.376 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.411 s
[INFO] Finished at: 2017-07-01T23:59:33+08:00
[INFO] Final Memory: 22M/256M
[INFO] ------------------------------------------------------------------------

2. dependency:tree

该goal会列举当前项目所有直接依赖和传递依赖(transitive dependency)

$ mvn dependency:tree
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.jiangjian:simple-weather:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 73, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 80, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building simple-weather 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact org.apache.commons:commons-io:jar:1.3.2 has been relocated to commons-io:commons-io:jar:1.3.2
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ simple-weather ---
[WARNING] The artifact org.apache.commons:commons-io:jar:1.3.2 has been relocated to commons-io:commons-io:jar:1.3.2
[INFO] com.jiangjian:simple-weather:jar:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- jaxen:jaxen:jar:1.1.1:compile
[INFO] |  +- jdom:jdom:jar:1.0:compile
[INFO] |  +- xerces:xercesImpl:jar:2.6.2:compile
[INFO] |  \- xom:xom:jar:1.0:compile
[INFO] |     +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] |     +- xalan:xalan:jar:2.6.0:compile
[INFO] |     \- com.ibm.icu:icu4j:jar:2.6.1:compile
[INFO] +- org.apache.velocity:velocity:jar:1.5:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.1:compile
[INFO] |  +- commons-lang:commons-lang:jar:2.1:compile
[INFO] |  \- oro:oro:jar:2.0.8:compile
[INFO] +- log4j:log4j:jar:1.2.14:compile
[INFO] \- commons-io:commons-io:jar:1.3.2:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.785 s
[INFO] Finished at: 2017-07-02T00:05:23+08:00
[INFO] Final Memory: 12M/245M
[INFO] ------------------------------------------------------------------------
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值