1.构建基本配置工程:
即简单的一个pom文件定义基本的内容,目前本事例只是修改配置deploy相关的配置,配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wmmad</groupId>
<artifactId>all</artifactId>
<version>1</version>
<packaging>pom</packaging>
<distributionManagement>
<repository>
<id>wmmad.releases</id>
<name>releases</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>wmmad.snapshots</id>
<name>snapshots</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>
定义本地release和snapshots的基本路径,主要是减少每个应用进行代码部署的拷贝。
多个版本主要是为了不同版本的适应
2.配置settings.xml:
增加服务器部署信息:
<server>
<id>wmmad.releases</id>
<username>deployment</username>
<password>12345</password>
</server>
<server>
<id>wmmad.snapshots</id>
<username>deployment</username>
<password>12345</password>
</server>
说明:
定义部署相关的信息,注意:id相同,表明你使用的部署权限。
3.部署:
在pom.xml文件所在的目录执行:
mvn deploy