Unable to get complete maven archetype list

那年仲夏 提交于 2019-12-20 01:14:36

问题


I'm trying generate a Maven project using archetype:generate but I only get a small list of archetypes:

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.)

Normally I get a list with more than 1000 elements. I tried with default central repository and the UK mirror but with the same result. I don't have a proxy.


回答1:


UPDATE: the problem with Maven Central has been fixed and the temporary work-around provided is this answer is no longer necessary.


It seems there is an on-going problem with the Maven Central catalog. The file http://repo1.maven.apache.org/maven2/archetype-catalog.xml is currently empty.

maven-archetype-plugin normally downloads this file and extract all the defined archetypes, which results in, as you experienced in the past, thousands of archetypes. Since Maven Central catalog is empty, the plugin is defaulting to its internal archetypes (and you can see what they are in the source code and notice there is only 10 of them, the result you are getting).

I reached out at the Maven mailing-list and am currently waiting for a response.

As a temporary workaround, you can define the following mirror of Maven Central in your settings.xml:

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


来源:https://stackoverflow.com/questions/32800381/unable-to-get-complete-maven-archetype-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!