下面这个配置文件实现了通过maven的deploy命令将本地打好的jar包发布到远程库。
比较关键的是下面这两步:
1, 将远程REPO配置到distributionManagement标签里面。
2, 将远程REPO的ID, 以及认证信息等放到Servers标签下面。
<?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">
<!-- localRepository -->
<localRepository>D:\_m2\repo</localRepository>
<servers>
<server>
<id>libs-snapshots-local</id>
<username>repouserid</username>
<password>repopwd</password>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-releases</name>
<url>http://repo.test.com/libs-releases</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>snapshots</id>
<name>libs-snapshots</name>
<url>http://repo.test.com/libs-snapshots</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-releases</name>
<url>http://repo.test.com/plugins-releases</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshots</name>
<url>http://repo.test.com/plugins-snapshots</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
<distributionManagement>
<snapshotRepository>
<id>libs-snapshots-local</id>
<name>JD maven2 repository-snapshots</name>
<url>http://repo.test.com/libs-snapshots-local</url>
</snapshotRepository>
</distributionManagement>
</settings>