1、在本地maven的 settings.xml
配置使用公司maven仓库时,配置个人账号,在 servers
节点增加配置(需要则配置,不需要则跳过)
本地密码如果不想以明文方式暴露可以参考: maven仓库密码加密
<server>
<id>pds-repoid>
<username>个人账号username>
<password>个人账号的密码password>
server>
2、在本地maven的 settings.xml
配置使用公司maven仓库,在 mirrors
节点增加配置
注意1:id需要跟server的id保持一致。
注意2:需要在mirrors元素里面按顺序配置mirror。
<mirrors>
<mirror>
<id>pds-repoid>
<name>pds-reponame>
<url>http://192.10.10.70:8081/repository/maven-public/url>
<mirrorOf>*mirrorOf>
mirror>
<mirror>
<id>aliyunmavenid>
<name>aliyun-mavenname>
<url>https://maven.aliyun.com/repository/publicurl>
<mirrorOf>*mirrorOf>
mirror>
mirrors>
3、在本地maven的 settings.xml
配置支持从snapshots仓库拉取快照,在 profiles
节点增加配置
<profiles>
<profile>
<id>devid>
<repositories>
<repository>
<id>pds-repoid>
<url>http://192.10.10.70:8081/repository/maven-public/url>
<releases>
<enabled>trueenabled>
releases>
<snapshots>
<enabled>trueenabled>
snapshots>
repository>
repositories>
profile>
<profile>
<id>aliyunid>
<repositories>
<repository>
<id>aliyunid>
<url>https://maven.aliyun.com/repository/public/url>
<releases>
<enabled>trueenabled>
releases>
<snapshots>
<enabled>trueenabled>
snapshots>
repository>
repositories>
profile>
profiles>
4、在本地maven的 settings.xml
激活配置,在 activeProfiles
节点增加配置
<activeProfiles>
<activeProfile>devactiveProfile>
<activeProfile>aliyunactiveProfile>
activeProfiles>
<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>C:\environment\apache-maven-3.6.3\maven-repolocalRepository>
<pluginGroups>
pluginGroups>
<proxies>
proxies>
<servers>
<server>
<id>pds-repoid>
<username>ibpdsusername>
<password>rootabc123password>
server>
servers>
<mirrors>
<mirror>
<id>pds-repoid>
<name>pds-reponame>
<url>http://192.10.10.70:8081/repository/maven-public/url>
<mirrorOf>*mirrorOf>
mirror>
<mirror>
<id>aliyunmavenid>
<mirrorOf>*mirrorOf>
<name>aliyun-mavenname>
<url>https://maven.aliyun.com/repository/publicurl>
mirror>
mirrors>
<profiles>
<profile>
<id>devid>
<repositories>
<repository>
<id>pds-repoid>
<url>http://192.10.10.70:8081/repository/maven-public/url>
<releases>
<enabled>trueenabled>
releases>
<snapshots>
<enabled>trueenabled>
snapshots>
repository>
repositories>
profile>
<profile>
<id>aliyunid>
<repositories>
<repository>
<id>aliyunid>
<url>https://maven.aliyun.com/repository/publicurl>
<releases>
<enabled>trueenabled>
releases>
<snapshots>
<enabled>trueenabled>
snapshots>
repository>
repositories>
profile>
profiles>
<activeProfiles>
<activeProfile>devactiveProfile>
<activeProfile>aliyunactiveProfile>
activeProfiles>
settings>