maven删除不必要的依赖;优化pom依赖研究

mvn dependency:copy-dependencies -DoutputDirectory=/home/admin/git/oceanus/test 会把所有依赖的插件版本都拷贝进去,而不是项目最后使用的插件

>mvn dependency:analyze

[INFO] --- maven-dependency-plugin:2.8:analyze (default-cli) @ wtp-core ---
[WARNING] Used undeclared dependencies found:
[WARNING]    org.springframework:spring-beans:jar:3.2.3.RELEASE:compile
[WARNING] Unused declared dependencies found:
[WARNING]    junit:junit:jar:4.7:test
[WARNING]    org.springframework:spring-test:jar:3.2.3.RELEASE:test
[WARNING]    org.slf4j:jcl-over-slf4j:jar:1.6.1:runtime
[WARNING]    org.slf4j:slf4j-log4j12:jar:1.6.1:runtime
[WARNING]    commons-lang:commons-lang:jar:2.5:test

参考:

1、https://www.jianshu.com/p/d828766786d4

2、http://www.cnblogs.com/yang-wu/p/3262499.html

3、https://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html

原文地址:https://www.cnblogs.com/shengulong/p/8118817.html