无法获得完整的 Maven 原型列表

Unable to get complete maven archetype list

我正在尝试使用 archetype:generate 生成 Maven 项目,但我只得到一小部分原型:

1: internal -> org.apache.maven.archetypes:maven-archetype-archetype (An archetype which contains a sample archetype.)
2: internal -> org.apache.maven.archetypes:maven-archetype-j2ee-simple (An archetype which contains a simplifed sample J2EE application.)
3: internal -> org.apache.maven.archetypes:maven-archetype-plugin (An archetype which contains a sample Maven plugin.)
4: internal -> org.apache.maven.archetypes:maven-archetype-plugin-site (An archetype which contains a sample Maven plugin site.
  This archetype can be layered upon an existing Maven plugin project.)
5: internal -> org.apache.maven.archetypes:maven-archetype-portlet (An archetype which contains a sample JSR-268 Portlet.)
6: internal -> org.apache.maven.archetypes:maven-archetype-profiles ()
7: internal -> org.apache.maven.archetypes:maven-archetype-quickstart (An archetype which contains a sample Maven project.)
8: internal -> org.apache.maven.archetypes:maven-archetype-site (An archetype which contains a sample Maven site which demonstrates
  some of the supported document types like APT, XDoc, and FML and demonstrates how
  to i18n your site. This archetype can be layered upon an existing Maven project.)
9: internal -> org.apache.maven.archetypes:maven-archetype-site-simple (An archetype which contains a sample Maven site.)
10: internal -> org.apache.maven.archetypes:maven-archetype-webapp (An archetype which contains a sample Maven Webapp project.)

通常我会得到一个包含超过 1000 个元素的列表。我尝试使用默认中央存储库和 UK 镜像,但结果相同。我没有代理。

更新:Maven Central 的问题已修复,提供的临时解决方法是不再需要此答案。


Maven Central 目录似乎一直存在问题。文件 http://repo1.maven.apache.org/maven2/archetype-catalog.xml 当前为空。

maven-archetype-plugin 通常会下载此文件并提取所有已定义的原型,正如您过去所经历的那样,这会产生数千个原型。由于 Maven Central 目录是空的,该插件默认使用其内部原型(您可以在 the source code 中看到它们是什么,并注意到它们只有 10 个,这就是您得到的结果)。

我联系了 Maven 邮件列表,目前正在等待回复。

作为临时解决方法,您可以在 settings.xml 中定义 Maven Central 的以下镜像:

<mirrors>
    <mirror>
        <id>ibiblio</id>
        <url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
</mirrors>