zoukankan      html  css  js  c++  java
  • Maven实战(Maven+Nexus建立私服【Linux系统】)

    准备工作

    下载及配置Maven3:http://www.cnblogs.com/leefreeman/archive/2013/03/05/2944519.html

    下载Nexus:http://nexus.sonatype.org/downloads/

    安装配置Nexus

    Nexus提供了两种安装方式,一种是内嵌Jetty的bundle,只要你有JRE就能直接运行。第二种方式是WAR,你只须简单的将其发布到web容器中即可使用。

    image

    建议下载上面这个,下载完成之后,解压到linux的相应位置:

    image

    上图中的 nexus-2.3.1-01和sonatype-work目录就是解压tar包后的两个目录,nexus-2.3.1-01中是nexus的核心文件,sonatype-work,会将下载来的开发包放置在其中。

    cd /data/program/nexus-2.3.1-01/bin/jsw
    ll

    image

    可以看到很多操作系统的版本目录,选择你的linux系统版本进去,如果不知道可以:

    uname –a

    image

    然后进入:

    image

    启动nexus

    ./nexus start

    image

    nexus启动成功,访问:http://192.168.6.204:8081/nexus/

    image

    点击右上角的“log on”进行登录,默认用户名和密码:admin / admin123

    可以看到左边菜单:

    image

    点击“Repositories”

    image

    关于hosted、proxy、group的概念这里就不讲了,大都介绍nexus的都有介绍,这里主要讲需要做的配置?

    点击Central,并切换到Configuration选项卡。

    image

    将Download Remote Indexes项设为True!这将打开nexus的下载远程索引的功能,便于使用nexus的搜索功能。

    配置Maven使用Nexus私服

    修改Maven的settings.xml 文件。

    在<settings></settings>之间添加:

    <profiles>
            <profile>
                <id>dev</id>
                <repositories>
                    <repository>
                        <id>local-nexus</id>
                        <url>http://192.168.6.204:8081/nexus/content/groups/public/</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </repository>
                </repositories>
            </profile>
        </profiles>
    
        <!-- activeProfiles | List of profiles that are active for all builds. | -->
        <activeProfiles>
            <activeProfile>dev</activeProfile>
        </activeProfiles>

    注意原settings.xml 文件中,已经存在profiles、activeProfiles的节点。

    如果你的eclipse,安装了m2eclipse插件,则设置:

    image

    image

    这样当项目需要开发包时,就会在本地仓库查找,如果查找不到就会到私服上查找,如果还查找不找就会去中央仓库去查找。下次等另一人需要同样的开发包时,就会从私服中查找,效果远比他重新从中央仓库下载快多了。

    未命名

  • 相关阅读:
    bzoj 2257 (JSOI 2009) 瓶子与燃料
    bzoj 2257 (JSOI 2009) 瓶子与燃料
    splay 模板 洛谷3369
    费用流 模板 洛谷3381
    bzoj 1024 [SCOI2009]生日快乐——模拟
    bzoj 3231 [Sdoi2008]递归数列——矩阵乘法
    hdu 5823 color II——子集dp(独立集)
    bzoj 1093 [ZJOI2007]最大半连通子图——缩点+拓扑
    洛谷 3959 宝藏——枚举+状压dp
    bzoj 1034 [ZJOI2008]泡泡堂BNB——贪心
  • 原文地址:https://www.cnblogs.com/leefreeman/p/2998315.html
Copyright © 2011-2022 走看看