Maven使用Nexus私服的配置

工作记录
——————————————————————————————
配置文件 apache-maven-3.3.3\conf\settings.xml
在mirrors(镜像)之间配置。
url为私服地址
<!-- 配置maven只使用私服时,第一个mirrorOf之间写*就行。osgeo和geosolutions不能使用nexus,必须绕过-->
<mirror>
    <id>nexus</id>
    <mirrorOf>external:*,!osgeo,!geosolutions</mirrorOf>
     <name>MyNexus</name> 
     <url>http://192.168.202.27:8081/nexus/content/groups/public</url>
</mirror>
 <mirror>
    <id>osgeo</id>
    <mirrorOf>osgeo</mirrorOf>
    <name>Open Source Geospatial Foundation Repository</name>
     <url>http://download.osgeo.org/webdav/geotools/</url>
 </mirror>
<mirror>
    <id>geosolutions</id>
    <mirrorOf>geosolutions</mirrorOf>
    <name>geosolutions repository</name>
     <url>http://maven.geo-solutions.it/</url>
</mirror>

在profiles之间配置

<!-- id为central:覆盖超级POM中中央仓库位置 -->
            <profile>
                <id>nexus</id>
                <repositories>
                    <repository>
                        <id>central</id>
                        <name>MyNexus</name>
                        <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>
</activeProfiles>

-----------------------------------------

posted @ 2016-06-24 17:24  yes_V_can  阅读(1118)  评论(0编辑  收藏  举报