• nexus的安装和简介(3)


    从私服下载jar 

    没有配置nexus之前,如果本地仓库没有,去中央仓库下载,通常在企业中会在局域网内部署一台私服服务器,有了私服本地项目首先去本地仓库找jar,如果没有找到则连接私服从私服下载jar包,如果私服没有jar包私服同时作为代理服务器从中央仓库下载jar包,这样做的好处是一方面由私服对公司项目的依赖jar包统一管理,一方面提高下载速度,项目连接私服下载jar包的速度要比项目连接中央仓库的速度快的多。

    本例子测试从私服下载dao 工程jar包。

    管理仓库组

    nexus中包括很多仓库,hosted中存放的是企业自己发布的jar包及第三方公司的jar包,proxy中存放的是中央仓库的jar,为了方便从私服下载jar包可以将多个仓库组成一个仓库组,每个工程需要连接私服的仓库组下载jar包。

    打开nexus配置仓库组,如下图:

     

    上图中仓库组包括了本地仓库、代理仓库等。

    setting.xml中配置仓库

    在客户端的setting.xml中配置私服的仓库,由于setting.xml中没有repositories的配置标签需要使用profile定义仓库。

    <profile>   

    <!--profileid-->

       <id>dev</id>   

        <repositories>   

          <repository>  

    <!--仓库idrepositories可以配置多个仓库,保证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>  

    使用profile定义仓库需要激活才可生效。

      <activeProfiles>

        <activeProfile>dev</activeProfile>

      </activeProfiles>

  • 相关阅读:
    codevs1430 素数判定
    codevs1212 最大公约数
    codevs1012 最大公约数和最小公倍数问题
    codevs1160 蛇形矩阵
    Debate CodeForces
    Divide Candies CodeForces
    Login Verification CodeForces
    Colorful Bricks CodeForces
    ExaWizards 2019 English D
    Cards and Joy CodeForces
  • 原文地址:https://www.cnblogs.com/zengpeng/p/10218228.html
Copyright © 2020-2023  润新知