码迷,mamicode.com
首页 > 编程语言 > 详细

Maven(二)-- 搭建私服,上传jar

时间:2017-04-10 00:31:14      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:ble   group   文件夹   make   code   url   bsp   snap   server   

一、在setting中配置 私服的镜像,在mirrors标签中加上:

<!--第一步  配置私服的镜像-->
<mirror>
     <!--此处配置所有的构建均从私有仓库中下载 *代表所有,也可以写central -->
     <id>nexus</id>
     <mirrorOf>*</mirrorOf>
     <!-- url对应发私服的 Public Repositories -->
     <url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>    

二、nexus工厂的配置,在profiles标签中加上:

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

三、激活profile配置

<!--第三步  激活profile配置 -->
  <activeProfiles>
     <!--make the profile active all the time -->
     <activeProfile>nexus</activeProfile>
  </activeProfiles>

 四、在pom.xml中配置

<repositories>
     <repository>
         <id>central</id>
         <url>http://localhost:8081/nexus/content/groups/public/</url>
         <releases><enabled>true</enabled></releases>
         <snapshots><enabled>true</enabled></snapshots>
     </repository>
</repositories>
<pluginRepositories>
     <pluginRepository>
         <id>central</id>
         <url>http://localhost:8081/nexus/content/groups/public/</url>
         <releases><enabled>true</enabled></releases>
         <snapshots><enabled>true</enabled></snapshots>
      </pluginRepository>
 </pluginRepositories>

 五、配置上传到私服,在pom中:

<distributionManagement> 
    <repository> 
        <id>releases</id> 
        <name>Internal Releases</name> 
        <url>http://localhost:8081/nexus/content/repositories/releases/</url> 
    </repository> 
</distributionManagement>

六、在nexus中配置权限

 

七、在pom.xml的servers标签中加上:

<server>
    <id>增加的maven库的id</id>
  <username>新建的名字</username>
  <password>pass</password>
</server>

 八、更新jar遇到错误:

  was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced

  解决办法:去自己的.m2 文件夹下把 xxx.lastUpdated 文件全部删掉,重新运行maven,ok!

 

  

 

Maven(二)-- 搭建私服,上传jar

标签:ble   group   文件夹   make   code   url   bsp   snap   server   

原文地址:http://www.cnblogs.com/xbq8080/p/6687057.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!