一、maven中的依赖
1.除了坐标元素外,还有以下元素
type: 类型jar war
scope: 依赖范围 compile编译、测试、运行(默认) test(测试) provided(编译、测试) runtime(测试、运行)system import
optional:依赖是否可选 true 依赖此项目的项目不会依赖声明为true的项目
exclutions:排除依赖
2.依赖原则
最短路径和第一声明优先
3.排除依赖<exclutions>
<exclution>
<groupId>...
<artifactId>...
</exclution>
</exclutions>
4.归类依赖
<properties>
<xxx.verion></xxx.version>
</properties>
5.优化依赖
mvn dependency:list
mvn dependency:tree
mvn dependence:analyze
二、仓库
1.本地仓库
~/.m2/repository
在settings.xml中重新配置
2.中央仓库
3.私服
4.配置远程仓库<repostiries>
<repository>
<id>
<name>
<url>
<release>true
<snapshots>false
<layout>default
5.认证
<servers>
<server>
<id>
<username>
<password>
6.部署至远程仓库
<distributionManagement>
<repository>
<id>
<name>
<url>
<snapshotRepository>
<id>
<name>
<url>
三、聚合和继承
1.聚合
<package>pom</package>
<modules>
<module></module>
</modules>
2.继承
可继承的pom
groupId version decription organization inceptionYear url developers distributionManagement issueManagement ciManagement scm properties dependencies dependencyManagement repositories
build reporting
3.裁剪反应堆
mvn clean install -pl | -am | -amd | -rf