作用:聚合用于快速构建maven工程,一次性构建多个项目/模块
制作方式:
<packaging>pompackaging>
<modules>
<module>../ssm_controllermodule>
<module>../ssm_servicemodule>
<module>../ssm_daomodule>
<module>../ssm_pojomodule>
modules>
作用:通过继承可以实现在子工程中沿用父工程中的配置
制作方式:
<parent>
<groupId>com.xcgroupId>
<artifactId>ssmartifactId>
<version>1.0-SNAPSHOTversion>
<relativePath>../ssm/pom.xmlrelativePath>
parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-contextartifactId>
<version>5.1.9.RELEASEversion>
dependency>
<dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-contextartifactId>
dependency>
dependencies>
作用
相同点:
不同点:
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-contextartifactId>
<version>5.1.9.RELEASEversion>
dependency>
<dependency>
<groupId>org.mybatisgroupId>
<artifactId>mybatisartifactId>
<version>3.5.3version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-jdbcartifactId>
<version>5.1.9.RELEASEversion>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-webmvcartifactId>
<version>5.1.9.RELEASEversion>
dependency>
作用
定义格式:
<properties>
<spring.version>5.1.9.RELEASEspring.version>
<junit.version>4.12junit.version>
properties>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-contextartifactId>
<version>${spring.version}version>
dependency>
作用
调用格式:
${basedir}
${version}
作用
调用格式:
${settings.localRepository}
作用
调用格式
${user.home}
mvn help:system
作用
调用格式
${env.JAVA_HOME}
mvn help:system
SNAPSHOT(快照版本)
ERLEASE(发布版本)
作用
调用格式
${jdbc.url}
<resources>
<resource>
<!—设定配置文件对应的位置目录,支持使用属性动态设定路径-->
<directory>${project.basedir}/src/main/resourcesdirectory>
<filtering>truefiltering>
resource>
resources>
<profiles>
<profile>
<id>pro_envid>
<properties>
<jdbc.url>jdbc:mysql://127.1.1.1:3306/ssm_dbjdbc.url>
properties>
<activation>
<activeByDefault>trueactiveByDefault>
activation>
profile>
<profile>
<id>dev_envid>
……
profile>
profiles>
作用
调用格式
mvn 指令 -p 环境定义id
mvn install -p pro_env
mvn 指令 -D skipTests
注意事项
<plugin>
<artifactId>maven-surefire-pluginartifactId>
<version>2.22.1version>
<configuration>
<skipTests>trueskipTests>
<includes>
<include>**/User*Test.javainclude>
includes>
<excludes>
<exclude>**/User*TestCase.javaexclude>
excludes>
configuration>
plugin>
nexus.exe /run nexus
http://localhost:8081
修改基础配置信息
修改服务器运行配置信息
宿主仓库hosted
代理仓库proxy
仓库组group
上传资源时提供对应的信息
<servers>
<server>
<id>xc-releaseid>
<username>adminusername>
<password>adminpassword>
server>
<server>
<id>xc-snapshotsid>
<username>adminusername>
<password>adminpassword>
server>
servers>
<mirrors>
<mirror>
<id>nexus-xcid>
<mirrorOf>*mirrorOf>
<url>http://localhost:8081/repository/maven-public/url>
mirror>
mirrors>
<distributionManagement>
<repository>
<id>xc-releaseid>
<url>http://localhost:8081/repository/xc-release/url>
repository>
<snapshotRepository>
<id>xc-snapshotsid>
<url>http://localhost:8081/repository/xc-snapshots/url>
snapshotRepository>
distributionManagement>
mvn deploy
rOf>
http://localhost:8081/repository/maven-public/
<distributionManagement>
<repository>
<id>xc-releaseid>
<url>http://localhost:8081/repository/xc-release/url>
repository>
<snapshotRepository>
<id>xc-snapshotsid>
<url>http://localhost:8081/repository/xc-snapshots/url>
snapshotRepository>
distributionManagement>
mvn deploy