配置私服

开启私服

3.5版本私服直接安装就能使用

nexus.exe /run命令直接运行,不要关闭cmd

上传jar包到私服

1. 把dao模块上传到私服(如果上述setting.xml文件中配置过再次检查是否配置完整正确):
    第一步:配置私服地址
            1. 在settings.xml添加:
         

          <server>
                <id>releases</id>
                <username>admin</username>
                <password>admin123</password>
          </server>
          <server>
                <id>snapshots</id>
                <username>admin</username>
                <password>admin123</password>
          </server>


        2.在当前项目的pom.xml文件添加:
          <!-- 配置远程发布到私服,mvn deploy -->
             

                <distributionManagement>
                    <repository>
                        <id>releases</id>
                        <url>http://localhost:8081/repository/maven-releases/</url>
                    </repository>
                    <snapshotRepository>
                        <id>snapshots</id>
                        <url>http://localhost:8081/repository/maven-snapshots/</url>
                    </snapshotRepository>
                </distributionManagement>


    第二步: 运行 deploy命令,不同开发工具会有差异。
    
    如果所有配置正确,发现上传私服失败,需要进入私服找到指定仓库
         Repository--- Access Settings--Deployment Policy修改为允许发布

从私服下载jar包

3.service模块从私服下载dao包
        1.1、在settings.xml文件中
      

     <profile>
        <id>dev</id>
        <repositories>
            <repository>
                <id>nexus</id>
                <name>nexus</name>
                <url>http://localhost:8081/repository/maven-public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>  
        <!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 -->
        <pluginRepository>  
            <!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 -->
            <id>public</id>  
            <name>Public Repositories</name>  
            <url>http://localhost:8081/repository/maven-public/</url>  
        </pluginRepository>  
    </pluginRepositories>  
    </profile>


    2.激活私服
        <!-- 激活 -->

<activeProfiles>
  <activeProfile>dev</activeProfile>
</activeProfiles>


          
注意:
    私服一般安装在内网的其他服务器上,而不是本机上。因此上面的配置中localhost的部分在实际情况中应该修改为公司中内网的私服服务器地址。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值