8 私服相关

1 私服:
nexus搭建流程
Maven Nexus3私服搭建指南
//www.greatytc.com/p/26626b8f9355
window 打开服务管理页面
https://www.kafan.cn/edu/88460466.html

2 关联私服
关联私服:修改 user 下的 maven 的 settings.xml配置文件
配置私服的登录账号

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

配置私服镜像地址

     <mirror>
         <id>nexus</id>
         <mirrorOf>*</mirrorOf>
         <url>http://localhost:8081/repository/maven-central/</url>
     </mirror>

配置仓库

   <profile>
         <id>nexus</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>
<activeProfiles>
        <activeProfile>nexus</activeProfile>
    </activeProfiles>

这样配置完成 就会把jar包下到私服

3 发布项目到私服

要发布项目到nexus上要在项目中的pom.xml最后配置

给出Maven部署当前项目的构件到远程库时,关于远程库的配置。示例如下:

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

我们分别配置了release版本和snapshot版本所对应的Repository,如果你项目的版本中包含了“SNAPSHOT”,此时将发布到Nexus的Snapshots Repository,否则发布在Releases Repository

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,991评论 19 139
  • |-1-更新内容[6.从仓库解析依赖的机制(重要)] 1Maven仓库作用 仓库用来存储所有项目使用到构件,在ma...
    zlcook阅读 6,168评论 0 25
  • 首先私服是一种衍生出来的特殊的Maven远程仓库,构建私服的好处请看3.5私服 可以帮助大家建立私服的仓库管理软件...
    zlcook阅读 10,667评论 0 32
  • 简介 概述 Maven 是一个项目管理和整合工具 Maven 为开发者提供了一套完整的构建生命周期框架 Maven...
    闽越布衣阅读 4,362评论 6 39
  • 踏入2018年,第一个坏消息是机械行业不断传来涨价消息,各路商家好像早有“预谋”,纷纷举起涨价大旗,似乎想过个肥年...
    玉扳手阅读 299评论 0 1