项目编译工具Maven:将项目发布到远程仓库

一、修改maven的配置文件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>
      	<!-- 与repositoryID保持一致 -->
        <id>repositoryID</id>
        <username>admin</username>
        <password>admin</password>
      </server>
    </servers>

    <repositories>
    	<repository>
            <id>repositoryID</id>
            <name>repositoryName</name>
            <url> repositoryURL</url>
			......
        </repository>
	</repositories>
 
	......
	
</settings>

二、修改指定模块代码的pom.xml文件

<?xml version="1.0"?>
<project
	xsi:schemaLocation=" http://maven.apache.org/POM/4.0.0 	http://maven.apache.org/xsd/maven-4.0.0.xsd"
	xmlns=" http://maven.apache.org/POM/4.0.0"
	xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
 
	......
 
	<dependencies>
	    ......
	</dependencies>
 
	<distributionManagement>
	    <repository>
		    <id>repositoryID</id>
            <name>repositoryName</name>
            <url> repositoryURL</url>
	    </repository>
		<snapshotRepository>
		    <id>snapshotRepositoryID</id>
            <name>snapshotRepositoryName</name>
            <url> snapshotRepositoryURL</url>
		</snapshotRepository>
	</distributionManagement>

	......
 
</project>

三、执行maven指令推送到远程仓库

在这里插入图片描述

©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页