首先需要配置遠(yuǎn)程倉(cāng)庫(kù)私服的服務(wù)器賬號(hào)、密碼,找到maven的settings.xml文件,配置<server>,里邊的ID注意,就是標(biāo)識(shí)你倉(cāng)庫(kù)的唯一ID,可以根據(jù)你的倉(cāng)庫(kù)隨意起名就行。
<servers>
<!-- server
| Specifies the authentication information to use when connecting to a particular server, identified by
| a unique name within the system (referred to by the 'id' attribute below).
|
| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
| used together.
|
<server>
<id>deploymentRepo</id>
<username>repouser</username>
<password>repopwd</password>
</server>
-->
<!-- Another sample, using keys to authenticate.
<server>
<id>siteServer</id>
<privateKey>/path/to/private/key</privateKey>
<passphrase>optional; leave empty if not used.</passphrase>
</server>
-->
<!-- 在這里添加配置私倉(cāng)的ID和賬號(hào)、密碼 -->
<server>
<id>mycentral</id>
<username>私服賬號(hào)</username>
<password>私服密碼</password>
</server>
<server>
<id>mysnapshots</id>
<username>私服賬號(hào)</username>
<password>私服密碼</password>
</server>
</servers>
然后找到你代碼工程中的pom.xml文件,配置<distributionManagement>或<repositories>,這2個(gè)字段的區(qū)別就是
distributionManagement是使用mavne deploy上傳打好的包。
repositories就跟打包上傳無(wú)關(guān),只是你想在POM中配置其它的遠(yuǎn)程倉(cāng)庫(kù)。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-509903.html
所以你可以根據(jù)需要全部配置或只配置其中一個(gè)。注意其中的ID,一定要和你在settings.xml中配置server賬號(hào)的ID保持一致,才能關(guān)聯(lián)生效文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-509903.html
<distributionManagement>
<repository>
<!--注意ID配置與settings.xml中server配置ID保持一致-->
<id>mycentral</id>
<name>Artifactory-releases</name>
<url>https://私倉(cāng)地址.com.cn/artifactory/Management_Application_Maven</url>
</repository>
<snapshotRepository>
<id>mysnapshots</id>
<name>Artifactory-snapshots</name>
<url>https://私倉(cāng)地址.com.cn/artifactory/Management_Application_Maven</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<!--注意ID配置與settings.xml中server配置ID保持一致-->
<id>mysnapshots</id>
<url>https://devstack.vgc.com.cn/artifactory/Timesheet_Management_Application_Maven</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<!--注意ID配置與settings.xml中server配置ID保持一致-->
<id>mycentral</id>
<url>https://devstack.vgc.com.cn/artifactory/Timesheet_Management_Application_Maven</url>
</repository>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
到了這里,關(guān)于maven配置遠(yuǎn)程倉(cāng)庫(kù)私服的服務(wù)器賬號(hào)、密碼的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!