打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
[Maven]Nexus 安装与配置
1
下载Nexus
http://www.sonatype.org/nexus/go

2
安装
解压即可
D:\bisoft\tools
          nexus-2.0.4-1
          sonatype-work

3
配置环境变量
NEXUS_HOME=D:\bisoft\tools\nexus-2.0.4-1
PATH 添加  %NEXUS_HOME%\bin\jsw\windows-x86-64

$NEXUS_HOME/conf/nexus.properties 可修改基本配置信息,如 sonatype-work 目录位置.
nexus-work=${bundleBasedir}/../sonatype-work/nexus

4
故障解决方案:
The nexus-webapp service was launched, but failed to start.

环境变量|系统变量|JAVA_HOME & PATH.
注意是系统变量下,不是用户变量.

5
运行
install-nexus.bat
console-nexus.bat
nexus start|stop

查看日志
%NEXUS_HOME%/logs/wrapper.log

6
进入Nexus管理界面
http://localhost:8081/nexus
管理员
账号:admin
密码:admin123

部署用户:
deployment
deployment123

匿名用户:


7
$NEXUS_HOME/conf/wrapper-override.conf 可重写nexus服务配置.

8
启用远程索引下载
左边| Repositories|选择一个远程代理仓库|下边Tab Configuration|Download Remote Indexes|true|Save|上边菜单Refresh.



默认有三个代理仓库:
Maven Central repository
Apache Snapshot repository
Codehaus Snapshot repository

现在自动开始下载索引文件.这个只会下载索引,不会下载JAR.除非手动下载啦.

9
手动下载:
下边TAB Brower Index | 找到JAR | 右边 |download.
现在,在D:\bisoft\tools\sonatype-work\nexus\storage\central\中缓存了JAR包.

10
安装为服务
64位执行 nexus.bat install 报错,原因是权限不啦.

解决办法:
新建一个nexus-install.bat:
nexus.bat install

然后右键|以管理员身份运行(好像管理员必须要密码才行....)

11
管理组,组是一个很好的东西,它能组合多个仓库并映射到一个URL上.
Nexus 默认提供一个组:Public Repositories.




Ordered Group Repositories:新加的仓库,将仓库加入其中即可.


12
改变nexus监听端口
$NEXUS_HOME/conf/nexus.properties
application-port=8081

13
配置 Maven
%user.dir%/.m2/settings.xml

Xml代码
 
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"   
  3.           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
  4.           xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">  
  5.             
  6.   <localRepository>D:\bisoft\tools\maven3\repository</localRepository>  
  7.   
  8.   <pluginGroups>  
  9.     <pluginGroup>org.mortbay.jetty</pluginGroup>  
  10.     <pluginGroup>org.codehaus.cargo</pluginGroup>  
  11.   </pluginGroups>  
  12.   
  13.   <proxies>  
  14.   </proxies>  
  15.   
  16.   <servers>  
  17.     <server>  
  18.         <id>releases</id>  
  19.         <username>admin</username>  
  20.         <password>admin123</password>  
  21.     </server>  
  22.     <server>  
  23.         <id>snapshots</id>  
  24.         <username>admin</username>  
  25.         <password>admin123</password>  
  26.     </server>    
  27.   </servers>  
  28.   
  29.   <mirrors>  
  30.     <mirror>  
  31.       <id>nexus</id>  
  32.       <mirrorOf>*</mirrorOf>  
  33.       <url>http://localhost:8081/nexus/content/groups/public</url>  
  34.     </mirror>  
  35.   </mirrors>  
  36.   
  37.   <profiles>  
  38.     <profile>  
  39.       <id>nexus</id>  
  40.       <repositories>  
  41.         <repository>  
  42.           <id>central</id>  
  43.           <url>http://central</url>  
  44.           <releases><enabled>true</enabled></releases>  
  45.           <snapshots><enabled>true</enabled></snapshots>  
  46.         </repository>  
  47.       </repositories>  
  48.      <pluginRepositories>  
  49.         <pluginRepository>  
  50.           <id>central</id>  
  51.           <url>http://central</url>  
  52.           <releases><enabled>true</enabled></releases>  
  53.           <snapshots><enabled>true</enabled></snapshots>  
  54.         </pluginRepository>  
  55.       </pluginRepositories>  
  56.     </profile>  
  57.   </profiles>  
  58.   
  59.   <activeProfiles>  
  60.     <activeProfile>nexus</activeProfile>  
  61.   </activeProfiles>  
  62. </settings>  
  63.   
  64. </settings>  


配置部署
pom.xml

Xml代码
 
  1. <distributionManagement>   
  2. <repository>   
  3.     <id>releases</id>   
  4.     <name>Internal Releases</name>   
  5.     <url>http://localhost:8081/nexus/content/repositories/releases</url>   
  6. </repository>   
  7. <snapshotRepository>   
  8.     <id>Snapshots</id>   
  9.     <name>Internal Snapshots</name>   
  10.     <url>http://localhost:8081/nexus/content/repositories/snapshots</url>   
  11. </snapshotRepository>   
  12. </distributionManagement>  



14
上传第三方包
14.1 
mvn deploy:deploy-file -Dgroup -Dartifact
-Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc.jar  
-Durl=http://localhost:8081/nexus/content/repositories/thirdparty  
-Drepository

14.2
直接复制到仓库

14.3
界面上传

15.
备份

直接备份 sonatype-work 目录即可.


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Jenkins服务器安装与配置
Linux(CentOS7.x)安装Maven
maven安装和eclipse集成以及Maven之setting.xml配置文件详解
用nexus搭建自己的maven私有倉庫
Sonatype Nexus 搭建Maven 私服
关于Maven
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服