在實際項目開發中,有時候需要將我們的項目安裝至公司的私服供其他項目組使用,此時則需要在pom文件中加如下配置
<distributionManagement> <repository> <!-- 唯一標識符 --> <id>prok-releases</id> <!-- 倉庫名稱 --> <name>Proj Release Repository</name> <!-- 倉庫地址 --> <url>http://192.168.1.100/content/repository/proj-releases</url> </repository> <snapshotRepository> <id>proj-snapshots</id> <name>Proj Snapshot Repository</name> <url>http://192.168.1.100/content/repository/proj-snapshots</url> </snapshotRepository> </distributionManagement>
如果需要密碼則需要在${MAVEN_HOME}/conf/settings.xml文件中配置認證
<server>
<id>prok-releases</id> <!-- 於私服的倉庫id一致(上面) -->
<username>repouser</username>
<password>repopwd</password>
</server>
摘取至《Maven實戰》