maven部署

maven部署

1. pom.xml 中添加私有仓库配置:

<distributionManagement>
<repository>
<id>releases</id>
<url>http://实际路径:8082/nexus/content/repositories/releases</url>
</repository>

<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshots</name>
<url>http://实际路径:8082/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>

其中:id = snapshots,releases 的是仓库id,url是对应的地址


2.配置maven本地依赖库中权限认证:

在本地C:\Users\sw\.m2\settings.xml 中,注意:已实际路径为准

配置:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
	<servers> 
		<server>  
			<id>releases</id>  
			<username>用户名</username>  
			<password>密码</password>  
		  </server>  
		 <server>  
			<id>snapshots</id>  
			<username>用户名</username>  
			<password>密码</password>  
		 </server>  
	</servers> 
</settings>


3.执行打包命令:

进入到项目实际的pom.xml 目录,执行:mvn clean package install deploy