[Maven]Nexus 安装与配置

1
下载Nexus
[url]http://www.sonatype.org/nexus/go[/url]

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\[i]windows-x86-64[/i]

$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管理界面
[url]http://localhost:8081/nexus[/url]
管理员
账号:admin
密码:admin123

部署用户:
deployment
deployment123

匿名用户:


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

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

[img]http://sonatype.com/books/nexus-book/reference/figs/web/repository-manager_repository-config.png[/img]

默认有三个代理仓库:
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.


[img]http://sonatype.com/books/nexus-book/reference/figs/web/repository-manager_group-config.png[/img]

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


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

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


<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<localRepository>D:\bisoft\tools\maven3\repository</localRepository>

<pluginGroups>
<pluginGroup>org.mortbay.jetty</pluginGroup>
<pluginGroup>org.codehaus.cargo</pluginGroup>
</pluginGroups>

<proxies>
</proxies>

<servers>
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>

<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>

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

<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>

</settings>



配置部署
pom.xml


<distributionManagement>
<repository>
<id>releases</id>
<name>Internal Releases</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>Snapshots</id>
<name>Internal Snapshots</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</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 目录即可.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值