zoukankan      html  css  js  c++  java
  • java的maven项目(三)私服的搭建(windows版)

    1       私服 nexus

    安装nexus

     

    启动服务

     

     

    启动失败的解决方法:

     

    登录nexus

    用户名/密码  admin/admin123

    仓库类型

     

    Virtual   虚拟仓库

    Proxy  代理仓库

    Hosted  宿主仓库  本地仓库

    Group 组

    需求:

    把dao放到私服上,然后service从私服上下载

    需求 :将ssh_dao的这个工程打成jar包,并放入到私服上去.

    1.1     上传dao

    第一步: 需要在客户端即部署dao工程的电脑上配置 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>

    第二步: 配置项目pom.xml

    配置私服仓库的地址,本公司的自己的jar包会上传到私服的宿主仓库,根据工程的版本号决定上传到哪个宿主仓库,如果版本为release则上传到私服的release仓库,如果版本为snapshot则上传到私服的snapshot仓库

     

     

     <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>

    注意:pom.xml这里<id> 和 settings.xml 配置 <id> 对应!

    第三步:执行deploy命令发布到私服

    1.2     下载dao

    第一步 修改settings.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>
    
     

    第二步 删除本地仓库中的dao

    第三步 update service工程,出现以下信息说明已经成功

     

  • 相关阅读:
    截取UIImagePickerController的拍照事件
    Xcode报错:run custom shell script '[cp] copy pods resource
    XCode报错:Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
    Mac环境下实现alias的重命名命令(永久生效)
    Swift 3.0在集合类数据结构上的一些新变化
    iOS几种简单有效的数组排序方法
    二分法查找、快速排序思想与实现
    iOS10 相册权限
    ios应用版本号设置规则
    iOS白名单设置
  • 原文地址:https://www.cnblogs.com/benjamin77/p/9366501.html
Copyright © 2011-2022 走看看