A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 播妞 程序媛   /  2018-12-12 17:13  /  1023 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

私服(nexus)
  • 私服的搭建一般由运维人员来做的
安装nexus 和 启动
  • 解压nexus-2.12.0-01-bundle.zip后得到两个文件夹
    • 私服仓库
    • 私服软件: BS结构的,通过浏览器访问
  • 安装:
    • 进入到私服的bin目录下: nexus.bat install
    • 安装成功后本地服务里会多了个nexus服务,默认没有启动
    • 我们通过命令行启动: nexus.bat start
  • 启动失败的解决方法: nexus/nexus-2.12.0-01/bin/jsw/conf/wrapper.conf
    • 把第15行: wrapper.java.command=xxx(jdk安装路径)/bin/java.exe
  • 访问私服:
登录nexu
  • 用户名/密码(默认): admin/admin123
仓库类型
  • Virtual--->虚拟仓库(不起任何作用,以后也用不到)
  • Proxy--->代理仓库
  • Hosted--->宿主仓库---本地仓库
  • Group--->组
需求
  • 把dao放到私服上,然后service从私服上下载
    • 第一步:需要在客户端(部署dao工程的电脑)上配置maven环境,并修改settings.xml文件,配置连接私服的用户和密码
    • 此用户名和密码用于私服校验,因为私服需要知道上传都的账号和密码是否和私服中的账号和密码一致
    • 第二步:配置项目pom.xml,配置私服地址
    • 配置私服仓库的地址,本公司的自己的jar包会上传到私服的宿主仓库,根据工程的版本号决定上传到哪个宿主仓库,如果版本为release则上传到私服的release仓库,如果版本为snapshot则上传到私服的snapshot仓
    • 注意:pom.xml这里<id> 和 settings.xml 配置 <id> 对应
    • 在maven中配置用户信息(settings.xml)
    • 右键-->run as--->maven built...--->deploy
  • 修改后pom.xml版本号要改
[XML] 纯文本查看 复制代码
<server>
    <id>releases</id>
    <username>admin</username>
    <password>admin123</password>
</server>
<server>
    <id>snapshots</id>
    <username>admin</username>
    <password>admin123</password>
</server>

[XML] 纯文本查看 复制代码
<distributionManagement>
    <repository>
        <id>releases</id>
        <url>http://localhost:8081/nexus/content/repositories/releases/</url>
    </repository> 
    <snapshotRepository>
        <id>snapshots</id>
        <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
    </snapshotRepository> 
</distributionManagement>

  • 将ssh_dao的这个工程打成jar包,并放入到私服上去
    • 第一步 修改settings.xml
  • 删除本地仓库中的dao
  • update service工程,出现以下信息说明已经成功
[XML] 纯文本查看 复制代码
<profile>   
<!--profile的id-->
<id>dev</id>   
<repositories>   
    <repository>  
        <!--仓库id,repositories可以配置多个仓库,保证id不重复-->
        <id>nexus</id>   
        <!--仓库地址,即nexus仓库组的地址-->
        <url>http://localhost:8081/nexus/content/groups/public/</url>   
        <!--是否下载releases构件-->
        <releases>   
            <enabled>true</enabled>   
        </releases>   
        <!--是否下载snapshots构件-->
        <snapshots>   
            <enabled>true</enabled>   
        </snapshots>   
    </repository>   
</repositories>  
<pluginRepositories>  
    <!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 -->
    <pluginRepository>  
        <!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 -->
        <id>public</id>  
        <name>Public Repositories</name>  
        <url>http://localhost:8081/nexus/content/groups/public/</url>  
    </pluginRepository>  
</pluginRepositories>  
</profile> 
<activeProfiles>
    <activeProfile>dev</activeProfile>
</activeProfiles>



0 个回复

您需要登录后才可以回帖 登录 | 加入黑马