如何填充 Maven 中心的标签元数据字段下索引的内容?

How can I populate what is indexed under the tags metadata field in Maven central?

Maven Central 的 search facility 提供了几个不同的字段供您搜索。最熟悉的当然是组 ID、工件 ID 和版本。但还有其他人。例如,这里有一个查询,它搜索名为 tags:

的字段

http://search.maven.org/#search%7Cga%7C1%7Ctags%3Asbtplugin

如果您在该列表中选择一个工件并深入研究它,您确实会发现(一旦您越过损坏的链接!)pom.xml 有一个 sbtVersion 属性里面。

我想,也许这就是填充 tags 字段的方式:只需在 properties 节中添加任意 属性 即可。当然,上面寻找的标签是 sbtplugin,而检查的 属性 是 sbtVersion,所以显然还涉及其他内容,但我在任何地方都找不到这种机制。

那么 这个索引字段是如何填充的? 它是 Nexus 特定的功能吗?我可以使用 maven-deploy-plugin 来填充它吗?

如果我可以控制在该字段中输入的内容,那么能够以编程方式搜索该字段将非常非常有帮助。

引用自 Maven Central 本身的 API description

http://search.maven.org/#search|ga|1|tags:sbtplugin

Returns al artifacts in central that are sbtplugins. An sbtplugin is defined as an artifact with a pom including the properties "sbtVersion" and "scalaVersion".

还有

http://search.maven.org/#search|ga|1|tags:sbtVersion-0.11

Returns all artifacts in central that use sbt version 0.11

Sonatype 的 Joel Orlina 写道:

Older versions of the indexer that backs search.maven.org populated the tags field with the contents of the <description> element in the POM. The field is passed through some standard StopWord filters and maybe some other Lucene analyzers, so the full contents won't make it into the tags field. We made some changes a couple years back to help out the scala/sbt community where, based on specific elements we discover in scala/sbt-plugin poms, we synthesize three tags: sbtPlugin, sbtVersion, and scalaVersion. This allows users of sbt plugins to search for those types of artifacts, which, in many cases don't conform to the Maven2 repository layout and, as such, don't normally get indexed by the search.maven.org indexer.

There's not much else to the tags field.