Maven的Setting.xml配置问题:如何设置maven使用私有nexus plugin repository?

自己搭建了一个nexus仓库,希望Maven只指向这个Nexus仓库,但是现在只有普通仓库指向该nexus,而下载插件的时候却指向默认插件仓库(这个地址:https://repo.maven.apache.org...)求教maven setting文件怎么设置?

目前已设置setting中的mirror和profile,如下

    <mirror>
        <id>maven-public</id>
        <name>nexus</name>
        <url>http://xxx:8081/repository/maven-public/</url>
        <mirrorOf>public</mirrorOf>
    </mirror>

   <profile>
         <id>Nexus152</id>
         <activation>
             <jdk>1.8</jdk>
         </activation>
         <repositories>
            <repository>
                <id>public</id>
                <url>http://xxx:8081/repository/maven-public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
             </repository>
         </repositories>

         <pluginRepositories>
             <pluginRepository>
                    <id>central</id>
                    <url>http://xxx:8081/repository/maven-central/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
             </pluginRepository>
         </pluginRepositories>
    </profile>

于此同时,在pom文件中添加pluginRepositories是可以指向nexus的。

请求大神帮助!

阅读 3.6k
1 个回答

把url改成本地仓库路径

clipboard.png

clipboard.png

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题