Nexus笔记

1、4种仓库类型:

  • hosted(宿主仓库):存放开发项目构建(pom、jar、war等),支持snapshot(快照版)、release(发布版)和第三方(3rd party)开源jar包(比如:db2、oracle的驱动包)
  • proxy(代理仓库):代理远程仓库(比如:Maven官方中央仓库、JBoss仓库中心、阿里云仓库中心)
  • virtual(虚拟仓库):maven1使用类型,现已废弃
  • group(仓库组):一种概念,包含上述几种仓库类型,方便开发使用

2、开启代理仓库索引下载任务:

 

 

3、配置仓库和插件仓库地址,在pom.xml文件中配置仅对该项目有效,在setting.xml中配置对全局有效,pom.xml优先级高。

 

<repositories>
	<!-- 私有库地址 -->
	<repository>
		<id>nexus</id>
		<url>http://192.168.0.206:8081/nexus/content/groups/public/</url>
		<releases>
			<enabled>true</enabled>
		</releases>
		<snapshots>
			<enabled>true</enabled>
		</snapshots>
	</repository>
</repositories>
<pluginRepositories>
	<!--插件库地址 -->
	<pluginRepository>
		<id>nexus</id>
		<url>http://192.168.0.206:8081/nexus/content/groups/public/</url>
		<releases>
			<enabled>true</enabled>
		</releases>
		<snapshots>
			<enabled>true</enabled>
		</snapshots>
	</pluginRepository>
</pluginRepositories>
 4、项目构建发布

 

  • 项目的pom.xml增加发布配置
  • <distributionManagement>
    	<snapshotRepository>
    		<id>yiyun.snapshot</id>
    		<name>yiyun snapshot</name>
    		<url>http://192.168.0.206:8081/nexus/content/repositories/snapshots/
    		</url>
    	</snapshotRepository>
    	<repository>
    		<id>yiyun.release</id>
    		<name>yiyun release</name>
    		<url>http://192.168.0.206:8081/nexus/content/repositories/releases/
    		</url>
    	</repository>
    </distributionManagement>
     
  • setting.xml增加认证配置
  • <servers>
    	<server>
    		<id>nexus-releases</id>
    		<username>deployment</username>
    		<password>deployment123</password>
    	</server>
    	<server>
    		<id>nexus-snapshots</id>
    		<username>deployment</username>
    		<password>deployment123</password>
    	</server>
    </servers>
     注意:两个配置的id必须保持一致!
 5、上传第三方jar包

 

 参考图示步骤:1、填写jar包定位信息等 2、上传jar包 3、上传
6、仓库迁移
  • Nexus的构件仓库都保存在sonatype-work目录中,该目录的位置由nexus/conf/nexus.properties配置文件指定。
  • 仓库迁移需要两个过程:备份和还原
  • 备份仓库:将sonatype-work文件夹整体备份即可,也可以选择只备份最重要的两个文件夹索引(indexer)和仓库(storage)
  • 还原仓库:将备份好的sonatype-work文件拷贝到新的服务器中。然后修改nexus/conf/nexus.properties配置文件,重新指定仓库的目录。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值