首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Nexus的简略使用

2012-11-08 
Nexus的简单使用Nexus的简单使用首页http://nexus.sonatype.org/参考文档官方http://www.sonatype.com/boo

Nexus的简单使用
Nexus的简单使用

首页
http://nexus.sonatype.org/

参考文档官方
http://www.sonatype.com/books/nexus-book/reference/

参考BLOG
http://www.blogjava.net/aoxj/archive/2008/09/06/227453.html

下载地址
http://nexus.sonatype.org/downloads/

得到文件
nexus-webapp-1.3.6-bundle.zip
nexus-webapp-1.3.6-bundle.tar.gz

1、WINDOWS上安装
可执行文件在%nexus安装目录
D:\soft\nexus-webapp-1.3.6-bundle\nexus-webapp-1.3.6\bin\jsw\windows-x86-32
下:
InstallNexus.bat/UninstallNexus.bat是安装/卸载nexus为windows service,如果需要设置nexus为开机自动启动就可以安装为windows service然后设置启动方式为自动。
Nexus.bat是直接在命令行中启动Nexus,如果不想安装Nexus为windows service,可以用这个文件来手工控制Nexus的启动退出。

2、redhat安装
tar zxvf nexus-webapp-1.3.6-bundle.tar.gz
mv nexus-webapp-1.3.6/ /usr/local/
cd /usr/local/nexus-webapp-1.3.6/
给与权限
chmod -R a+x bin
./bin/jsw/linux-x86-32/nexus start

3、nexus设置
访问地址
http://localhost:8081/nexus
登陆名admin 密码 admin123

开启远程索引下载
点击View/Repositories菜单下面的Repositories,将这三个仓库
Apache Snapshots
Codehaus Snapshots
Maven Central的
Download Remote Indexes修改为true。
然后在这三个仓库上分别右键,选择Re-index,这样Nexus就会去下载远程的索引文件。

配置maven
使用和原来设置artifactory相似的方法
<profile>
      <id>nexus_local</id>
      <repositories>
        <repository>
            <id>nexus_local</id>
            <name>local private nexus</name>
            <url>http://localhost:8081/nexus/content/groups/public</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>false</enabled></snapshots>
        </repository>
        <repository>
            <id>nexus_local</id>
            <name>local private nexus</name>
            <url>http://localhost:8081/nexus/content/groups/public-snapshots</url>
            <releases><enabled>false</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
            <id>nexus_local</id>
            <name>local private nexus</name>
            <url>http://localhost:8081/nexus/content/groups/public</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>false</enabled></snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>nexus_local</id>
            <name>local private nexus</name>
            <url>http://localhost:8081/nexus/content/groups/public-snapshots</url>
            <releases><enabled>false</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
       </pluginRepositories>
</profile>

<activeProfiles>
<activeProfile>nexus_local</activeProfile>
</activeProfiles>

为nexus增加Artifact
在nexus中我选择将这些Artifact上传到默认安装就存在的仓库3rd Party中,右击仓库名,
选择Upload Artifact

为nexus增加新的proxy repository

方法很简单,
Repositories -> add -> proxy,填写后保存即可。但是要注意,nexus不会自动将新加入的repository添加到group中,而我们一般喜欢直接使用默认的"public repository" group, 比如前面我在maven的profile中就只设置了这一个URL: http://localhost:8081/nexus/content/groups/public。因此需要手工修改"public repository" group的设置,将刚才添加的proxy repository加到组中。
推荐的repository有:
1) jboss         http://repository.jboss.com/maven2/
2) sun            http://download.java.net/maven/2/
3)k-int           http://developer.k-int.com/maven2/
加入这个纯粹是因为它有sun的jmxri/jmxtools这些Artifact,强烈鄙视sun,自己的官方repository居然没有。
4)sonatype    http://repository.sonatype.org/content/groups/public/

热点排行