maven+nexus+Linux配置Maven私服

  1. 准备工作
    安装
    下载maven:https://maven.apache.org/download.cgi
    下载Nexus:https://www.sonatype.com/download-oss-sonatype 建议选择版本

    tar zxvf  nexus-2.12.0-01-bundle.tar.gz命令解压到linxu环境会出现nexus-2.12.0-01和sonatype-work两个文件,nexus-2.12.0-01中是nexus的核心文件,sonatype-work,会将下载来的开发包放置在其中
  2. 启动

    cd  /tool/nexus-2.12.0-01-bundle/nexus-2.12.0-01/bin


    启动命令:./nexus start 



    注:启动可能会出现错误,根据错误信息进行修改,1、配置root环境变量,vi /etc/profile  export RUN_AS_USER=root;2、启用修改:source /etc/profile 

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

    登录,点击右上角的log in,默认:admin/admin123

    可以看到左边菜单:

    image

    点击“Repositories”

    image

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

    image

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






  3. 配置maven使用nexus私服,配置setting.xml文件

     <!--配置私服地址映射-->
    	<mirrors>
    	    <mirror>
    	        <id>nexus</id>
    	        <mirrorOf>*</mirrorOf>
    	        <name>MyRepository</name>
    	        <!--私服仓库地址-->
    	        <url>http://192.168.3.33:8081/nexus/content/groups/public</url>
    	    </mirror>
      	</mirrors>
    
    	<localRepository>E:\mysoft\mavenJar\m2\repository</localRepository>
    	<!--覆盖默认的中央仓库地址-->
    	<profiles>
    		<profile>
    		        <id>nexus</id>
    		        <repositories>
    		            <repository>
    		                <id>central</id>
    		                <name>MyRepository</name>
    		                <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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值