如何解析/解压缩/解压缩由Nexus生成的Maven存储库索引 [英] How to parse/unzip/unpack Maven repository indexes generated by Nexus

查看:226
本文介绍了如何解析/解压缩/解压缩由Nexus生成的Maven存储库索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从 http://mirrors.ibiblio.org/pub/mirrors/maven2/dot-index/nexus-maven-repository-index.gz

我想列出这些索引文件中的工件信息(例如groupId,artifactId,version)。我已经读过有一个高级API。似乎我必须使用以下maven依赖项。但是,我不知道使用什么入口点(哪个类?)以及如何使用它来访问这些文件:

I would like to list the artifacts information from these index files (groupId, artifactId, version for example). I have read that there is a high level API for that. It seems that I have to use the following maven dependency. However, I don't know what is the entry point to use (which class?) and how to use it to access those files:

<dependency>
    <groupId>org.sonatype.nexus</groupId>
    <artifactId>nexus-indexer</artifactId>
    <version>3.0.4</version>
</dependency>


推荐答案

看一看 https://github.com/cstamas/maven-indexer-examples 项目。

简而言之:您不需要手动下载GZ / ZIP(新/旧格式),它将为您做好索引(此外,它还会为您处理增量更新,如果可能的话) )。

In short: you dont need to download the GZ/ZIP (new/legacy format) manually, it will indexer take care of doing it for you (moreover, it will handle incremental updates for you too, if possible).

GZ是新格式,独立于Lucene索引格式(因此,独立于Lucene版本)仅包含数据,而ZIP是旧格式,这实际上是普通的Lucene 2.4.x索引压缩了。目前没有数据内容发生变化,但计划在未来发生。

GZ is the "new" format, independent of Lucene index-format (hence, independent of Lucene version) containing data only, while the ZIP is "old" format, which is actually plain Lucene 2.4.x index zipped up. No data content change happens currently, but is planned in future.

正如我所说,两者之间没有数据内容差异,但有些字段(如您所注意到的)是索引但不存储在索引上,因此,如果您使用ZIP格式,您将可以搜索它们,但无法检索。

As I said, there is no data content difference between two, but some fields (like you noticed) are Indexed but not stored on index, hence, if you consume the ZIP format, you will have them searchable, but not retrievable.

这篇关于如何解析/解压缩/解压缩由Nexus生成的Maven存储库索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆