Maven私服索引文件

nexus私服搭建

首先本地搭建Nexus私服,此处采用的版本是Nexus OSS 2.XX。

下载完成后,配置对应的环境变量,cmd模式下执行

nexus start

可以看到如下的效果

前台访问

http://localhost:8081/nexus

就可以进入相应Nexus私服界面。

Maven配置

主要是对登录用户等配置文件进行修改如下。

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
   <localRepository>E:/repository</localRepository>

  <pluginGroups>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>
	<server>
		<id>nexus</id>
		<username>admin</username>
		<password>admin123</password>
	</server>
  </servers>
  <mirrors>
	<!-- 阿里云仓库 -->
	<mirror>
		<id>alimaven</id>
		<mirrorOf>central</mirrorOf>
		<name>aliyun maven</name>
		<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
	</mirror>

	<!-- 中央仓库1 -->
	<mirror>
		<id>repo1</id>
		<mirrorOf>central</mirrorOf>
		<name>Human Readable Name for this Mirror.</name>
		<url>http://repo1.maven.org/maven2/</url>
	</mirror>

	<!-- 中央仓库2 -->
	<mirror>
		<id>repo2</id>
		<mirrorOf>central</mirrorOf>
		<name>Human Readable Name for this Mirror.</name>
		<url>http://repo2.maven.org/maven2/</url>
	</mirror>
	
	<!--本地私服-->	
	<mirror>   
		<id>nexus-mirror</id>   
		<mirrorOf>maven-central</mirrorOf>   
		<url>http://127.0.0.1:8081/nexus/content/repositories/central/</url>   
	</mirror>
  </mirrors>
  <profiles>
	<profile>
		<id>nexuesProfile</id>
		<repositories>
		  <repository>
			  <id>maven-central</id>
			  <name>maven-central</name>
			  <url>http://127.0.0.1:8081/nexus/content/repositories/central/</url>
			  <snapshots>
				  <enabled>true</enabled>
			  </snapshots>
			  <releases>
				  <enabled>true</enabled>
			  </releases>
		  </repository>
		</repositories>
	</profile>
  </profiles>
	<activeProfiles>
	  <activeProfile>nexuesProfile</activeProfile>
	</activeProfiles>
</settings>

所有配置内容如上。

重启Nexus,用户名录,用户名:admin,密码:admin123,点击登录就可以登录成功。

索引文件

第一种方式

手动下载三个文件

索引文件 wget http://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.gz

索引属性文件 wget http://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.properties

索引解压工具:wget https://repo1.maven.org/maven2/org/apache/maven/indexer/indexer-cli/5.1.1/indexer-cli-5.1.1.jar

把三个文件复制到 /%NEXUS_HOM%E/sonatype-work/nexus/indexer/central-ctx,然后执行

java -jar indexer-cli-5.1.1.jar -u nexus-maven-repository-index.gz -d /.

解压缩索引文件。最后启动Nexus私服,索引生效

第二种方式

前台配置方式。admin用户登录后,打开Repositories标签,选中远程仓库并打开Configuration,将Download Romote Location 设置为true; 在远程仓库上右键选择Update Index,Nexus会自动建立一条任务计划;一般远程仓库都比较大,构建会比较多,索引文件会很大,像http://repo1.maven.org/maven2/就有几百M,因此需要的时间就比较长。 如果想要查看当前进度,可以进入Scheduled Tasks查看任务的执行情况,当执行完成时,远程仓库的索引就已经建立完毕了。等任务消失后说明已经下载成功,这时可以在下面页面中点击center 接着点击Browse Index如果已经有了,说明下载完毕。

以上就是针对此次Nexus私服搭建以及索引生成下载的过程记录,希望可以帮助到您。欢迎留言。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值