nexus + ivy 搭建lib仓库

一、nexus安装与启动html

Nexus官方下载地址:http://www.sonatype.org/nexus/go,目前最新的版本是2.7.2。apache

Nexu安装很是容易,由于它内嵌了Jetty,只要有JRE救能直接运行。解压Nexu包会获得两个目录nexus-2.7.2-03和sonatype-work,sonatype-work是默认仓库目录。运行、安装都是使用nexus-2.7.2-03/bin/nexus.bat文件,它的使用方式:windows

        Usage:nexus.bat { console : start : stop : restart : install : uninstall }ui

其中console是控制台方式运行,install是以windows service寄存,uninstall是下载windows service,start是运行windows service,stop是中止windows service,restart是重启windows service,。spa

Nexus默认端口是8081,能够在nexus-2.7.1-01/conf/nexus.properties中修改,启动后就能够经过地址:http://localhost/:8081/nexus 来访问了。rest

 

二、ant语法code

http://www.cnblogs.com/wufengxyz/archive/2011/11/24/2261797.htmlxml

 

三、nexus上传选填的group和Artifact会生成对应填入名称的路径,htm

ivysettings.xmlblog

<?xml version="1.0" encoding="utf-8"?> 
<ivysettings>
       <settings defaultResolver="public" checkUpToDate="true" defaultConflictManager="latest-time"/>
        <resolvers>
                <ibiblio name="public" m2compatible="true" root="http://127.0.0.1:8081/nexus/service/local/repositories/releases/content/"/>
                 <ibiblio name="3rdparty" m2compatible="true" root="http://127.0.0.1:8081/nexus/content/repositories/thirdparty/"/>      
        </resolvers>
</ivysettings> 

ivy.xml

<ivy-module version="2.0">
    <info organisation="org.apache" module="hello-ivy"/>
    <dependencies>
        <dependency org="commons-lang" name="commons-lang" rev="2.4"/>
        <dependency org="commons-cli" name="commons-cli" rev="1.0"/>
    </dependencies>
</ivy-module>

root和dependencies决定build时拉取库的地址,如当前设置拉取commons-lang的路径是:

http://127.0.0.1:8081/nexus/service/local/repositories/releases/content/commons-lang/commons-lang/2.4/commons-lang-2.4.jar

所以,nuxus上传时group和Artifact都填‘commons-lang‘,对应dependency的’org‘和’name‘,造成两层的commons-lang目录

相关文章
相关标签/搜索