maven - 无法获得完整的 Maven 原型(prototype)列表

标签 maven maven-3 maven-archetype

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

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 多个元素的列表。我尝试使用默认中央存储库和英国镜像,但结果相同。我没有代理。

最佳答案

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

Maven Central 目录似乎一直存在问题。文件http://repo1.maven.apache.org/maven2/archetype-catalog.xml当前为空。
maven-archetype-plugin通常会下载此文件并提取所有已定义的原型(prototype),正如您过去所经历的那样,这会产生数千个原型(prototype)。由于 Maven Central 目录为空,插件默认为其内部原型(prototype)(您可以在 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>

关于maven - 无法获得完整的 Maven 原型(prototype)列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32800381/

相关文章:

maven - 排除Maven依赖项

java - Maven war 插件问题

java - 为什么 Maven 会警告我有关编码的问题?

java - 在 Spring 3.1.0 中使用 Spring Data JPA

maven - VirtualBox - Ubuntu - Maven - 错误 trustAnchors 参数必须为非空

java - 用于测试和主要的不同 Maven 编译器版本

java - Maven 原型(prototype)的速度反射 : get data from Json

maven - 在 IntelliJ 中添加远程原型(prototype)目录

java - Maven、Spring Boot - 包依赖问题、集成测试

java - 添加 x.y.z.BUILD-SNAPSHOT 依赖项后 Maven 依赖项错误