大龙的博客

常用链接

统计

最新评论

安装Nexus私服

文章格式不好调,我是现在word里面写的,贴上来样式都变了,把原稿提供给大家下载吧,转载的话,请大家提供出处,尊重一下我的劳动成果:http://cangzhitao.com/wp-content/uploads/2012/04/Nexus-Install.doc
1、  下载Nexus:http://www.sonatype.org/downloads/nexus-2.0.3-bundle.tar.gz ,我所下的是带Web容器的bundle包,解压后有两个目录nexus-2.0.3为Nexus运行时所需要的文件,sonatype-work包含配置文件、日志文件、仓库文件等,备份时我们备份sonatype-work目录就行了;

2、  启动Nexus F:\Program Files\nexus-2.0.3\bin\jsw\windows-x86-32\nexus.bat,打开浏览器访问http://localhost:8081/nexus就能看到Nexus界面,默认是匿名访问,管理员默认用户名密码为admin/admin123;

3、  用管理员登陆,点击左边栏的Views/Repositories中的Repositories,找到Apache Snapshots,将下面的选项卡切换到Configuration,将Download Remote Indexes置为true,同样将Codehaus Snapshots,Central进行相同设置,保存后,将刚才的三个仓库,选中repaire index,更新并下载远程索引;

4、  修改<mirror>打开主目录下的settings.xml,在mirriors节点下面添加
<mirror>

<id>nexus</id>

<mirrorOf>*</mirrorOf>

<url>http://localhost:8081/nexus/content/groups/public</url>

</mirror>

修改<profiles,在节点profiles下面添加
<profile>

<id>nexus</id>

<repositories>

<repository>

<id>nexus</id>

<name>Nexus</name>

<url>http://localhost:8081/nexus/content/groups/public/</url>

<releases><enabled>true</enabled></releases>

<snapshots><enabled>true</enabled></snapshots>

</repository>

</repositories>

<pluginRepositories>

<pluginRepository>

<id>nexus</id>

<name>Nexus</name>

<url>http://localhost:8081/nexus/content/groups/public/</url>

<releases><enabled>true</enabled></releases>

<snapshots><enabled>true</enabled></snapshots>

</pluginRepository>

</pluginRepositories>

</profile>

修改<activeProfiles>节点
<activeProfiles>

<activeProfile>nexus</activeProfile>

</activeProfiles>

如果要发布jar包到私服,还需要配置<servers>节点
<server>

<id>releases</id>

<username>admin</username>

<password>admin123</password>

</server>

<server>

<id>snapshots</id>

<username>admin</username>

<password>admin123</password>

</server>

配置完,整个文件如下(节省空间,去除了注释):
<?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”>

<pluginGroups>

</pluginGroups>

</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>nexus</id>

<name>Nexus</name>

<url>http://localhost:8081/nexus/content/groups/public/</url>

<releases><enabled>true</enabled></releases>

<snapshots><enabled>true</enabled></snapshots>

</repository>

</repositories>

<pluginRepositories>

<pluginRepository>

<id>nexus</id>

<name>Nexus</name>

<url>http://localhost:8081/nexus/content/groups/public/</url>

<releases><enabled>true</enabled></releases>

<snapshots><enabled>true</enabled></snapshots>

</pluginRepository>

</pluginRepositories>

</profile>

</profiles>

<activeProfiles>

<activeProfile>nexus</activeProfile>

</activeProfiles>

</settings>

5、  配置完,eclipse首先会在私服寻找jar包,找不到将回到公共仓库寻找下载到私服,再下载到本地。如果要发布jar包到私服,在pom.xml里面加上如下配置:

<distributionManagement>

<repository>

<id>releases</id>

<name>Nexus Releases Respository</name>

<url>http://localhost:8081/nexus/content/repositories/releases</url>

</repository>

<snapshotRepository>

<id>snapshots</id>

<name>Nexus Snapshots Repository</name>

<url>http://localhost:8081/nexus/content/repositories/snapshots</url>

</snapshotRepository>

</distributionManagement>

maven在项目执行clean deploy命令时,将会部署到私服对应的Releases或Snapshots仓库

6、  Nexus的3rd party可以让我们直接上传jar包到私服,选择3rd party仓库,点击Artifact Upload选项卡,选择GAV Parameters,填入相关jar包版本信息,选中上传后,即可以在maven使用上传的jar包

posted on 2012-08-24 02:05 大龙 阅读(630) 评论(1)  编辑 收藏 引用

评论

# re: 安装Nexus私服 2016-08-15 18:24 做有为青年

谢谢博主。我刚学搭建nexus,挺不错的。  回复  更多评论   


只有注册用户登录后才能发表评论。
【推荐】超50万行VC++源码: 大型组态工控、电力仿真CAD与GIS源码库
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理