nexus maven私有库搭建

1.下载nexus包,linux命令 
wget http://sonatype-download.global.ssl.fastly.NET/nexus/oss/nexus-2.11.4-01-bundle.tar.gz 
2.解压nexus包 
  tar -zxvf  nexus-2.11.4-01-bundle.tar.gz 
3.配置环境变量 
  export RUN_AS_USER=root 
4.启动命令(start | stop | restart),前提是配置了Java环境,默认端口为8081 
./nexus-2.11.4-01/bin/nexus start 
5.可以修改自己默认端口(nexus-2.11.4-01/conf/nexus.properties) 
6.登录界面:http://IP:8081/nexus 
  
其中默认用户/密码:admin/admin123 
登录后的界面 

7.配置本地maven的setting配置 
  
Java代码   收藏代码
  1. <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"  
  2.           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  3.           xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">  
  4.   <!-- localRepository  
  5.    | The path to the local repository maven will use to store artifacts.  
  6.    |  
  7.    | Default: ${user.home}/.m2/repository  
  8.    
  9.   -->  
  10.  <localRepository>D:/MvnRepository</localRepository>  
  11.     <servers>   
  12.     <server>  
  13.     <id>nexus-releases</id>  
  14.     <username>admin</username>  
  15.     <password>admin123</password>  
  16.   </server>  
  17.   <server>  
  18.     <id>nexus-snapshots</id>  
  19.     <username>admin</username>  
  20.     <password>admin123</password>  
  21.   </server>  
  22.    </servers>   
  23.    <mirrors>   
  24.     <mirror>  
  25.         <id>nexus</id>  
  26.         <name>internal nexus repository</name>  
  27.         <url>http://192.168.149.192:8081/nexus/content/groups/public/</url>  
  28.         <mirrorOf>central</mirrorOf>  
  29.     </mirror>  
  30.   </mirrors>  
  31.    <profiles>  
  32.     <profile>  
  33.     <id>nexus</id>  
  34.     <repositories>  
  35.       <repository>  
  36.         <id>nexus</id>  
  37.         <name>Nexus</name>  
  38.         <url>http://192.168.149.192:8081/nexus/content/groups/public/</url>  
  39.         <releases><enabled>true</enabled></releases>  
  40.         <snapshots><enabled>true</enabled></snapshots>  
  41.       </repository>  
  42.     </repositories>  
  43.     <pluginRepositories>  
  44.       <pluginRepository>  
  45.         <id>nexus</id>  
  46.         <name>Nexus</name>  
  47.         <url>http://192.168.149.192:8081/nexus/content/groups/public/</url>  
  48.         <releases><enabled>true</enabled></releases>  
  49.         <snapshots><enabled>true</enabled></snapshots>  
  50.     </pluginRepository>  
  51.     </pluginRepositories>  
  52. <distributionManagement>  
  53.   <repository>  
  54.     <id>nexus-releases</id>  
  55.     <name>Nexus Releases Repository</name>  
  56.     <url>http://192.168.149.192:8081/nexus/content/repositories/releases/</url>  
  57.   </repository>  
  58.   <snapshotRepository>  
  59.     <id>nexus-snapshots</id>  
  60.     <name>Nexus Snapshots Repository</name>  
  61.     <url>http://192.168.149.192:8081/nexus/content/repositories/snapshots/</url>  
  62.   </snapshotRepository>  
  63. </distributionManagement>   
  64.   
  65.    <activeProfiles>  
  66.     <!-- 激活nexusRepo这个profile:只有激活才生效 -->  
  67.     <activeProfile>nexus</activeProfile>  
  68.   </activeProfiles>  
  69. </settings>  

8.pom.xml文件配置 
Java代码   收藏代码
  1. <distributionManagement>  
  2.         <repository>  
  3.             <id>nexus-releases</id>  
  4.             <name>Nexus Release Repository</name>  
  5.             <url>http://192.168.149.192:8081/nexus/content/repositories/releases/</url>  
  6.         </repository>  
  7.         <snapshotRepository>  
  8.             <id>nexus-snapshots</id>  
  9.             <name>Nexus Snapshot Repository</name>  
  10.             <url>http://192.168.149.192:8081/nexus/content/repositories/snapshots/</url>  
  11.         </snapshotRepository>  
  12.     </distributionManagement>  

基本配置已完成; 
具体详情可参考博客: 
http://blog.csdn.net/shenshen123jun/article/details/9084293  
http://www.cnblogs.com/luotaoyeah/p/3791966.html  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值