如项目中使用到公司Maven仓库信息,按如下配置修改
1、下载maven工具包
2、修改maven\conf下settings.xml
<settings xmlns=
"<a href="http://maven.apache.org/SETTINGS/1.0.0" "="" style="color: rgb(59, 115, 175); text-decoration: none; border-radius: 0px !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; min-height: auto !important; background: none !important;">http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi=
"<a href="http://www.w3.org/2001/XMLSchema-instance" "="" style="color: rgb(59, 115, 175); text-decoration: none; border-radius: 0px !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; min-height: auto !important; background: none !important;">http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/SETTINGS/1.0.0 <a href="http://maven.apache.org/xsd/settings-1.0.0.xsd" "="" style="color: rgb(59, 115, 175); text-decoration: none; border-radius: 0px !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; min-height: auto !important; background: none !important;">http://maven.apache.org/xsd/settings-1.0.0.xsd"
>
<!--设置本地仓库, 其中path to repository 根据自己的环境配置-->
<localRepository>path to repository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<!--设置私库认证信息-->
<servers>
<server>
<id>nexus</id>
<username>deployment</username>
<password>ycode2015</password>
</server>
<server>
<id>releases</id>
<username>deployment</username>
<password>ycode2015</password>
</server>
<server>
<id>snapshots</id>
<username>deployment</username>
<password>ycode2015</password>
</server>
</servers>
<!--设置私库mirror 表示maven所有的请求都由nexus来处理-->
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<name>Nexus Mirror.</name>
<url>http:
//nexus.ycode.cn/nexus/content/groups/public</url>
</mirror>
</mirrors>
<!--设置maven私库信息-->
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url>http:
//nexus.ycode.cn/nexus/content/groups/public/</url>
<releases>
<enabled>
true
</enabled>
</releases>
<snapshots>
<enabled>
true
</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus</name>
<url>http:
//nexus.ycode.cn/nexus/content/groups/public/</url>
<releases>
<enabled>
true
</enabled>
</releases>
<snapshots>
<enabled>
true
</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<!--覆盖maven中央仓库设置开启releases和snapshots版本的下载-->
<profile>
<id>central</id>
<repositories>
<repository>
<id>central</id>
<url>http:
//central</url>
<releases>
<enabled>
true
</enabled>
</releases>
<snapshots>
<enabled>
true
</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http:
//central</url>
<releases>
<enabled>
true
</enabled>
</releases>
<snapshots>
<enabled>
true
</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<!--激活私库信息的配置-->
<activeProfiles>
<activeProfile>nexus</activeProfile>
<activeProfile>central</activeProfile>
</activeProfiles>
</settings>
|
idea maven配置如下