执行 mvn archetype:generate with URL for 时未定义原型

Posted

技术标签:

【中文标题】执行 mvn archetype:generate with URL for 时未定义原型【英文标题】:No archetype defined when doing mvn archetype:generate with URL for 【发布时间】:2017-02-16 02:22:58 【问题描述】:

我在执行 mvn archetype:generate 时尝试将 archetypeCatalog 设置为 URL,但始终显示未找到目录或工件。

mvn archetype:generate -DarchetypeCatalog=http://myfaces.apache.org
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-archetype-plugin:3.0.0:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO] 
[INFO] <<< maven-archetype-plugin:3.0.0:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO] 
[INFO] --- maven-archetype-plugin:3.0.0:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] No catalog defined. Using internal catalog
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
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.)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 7: 

根据 Maven 原型指南,我应该能够将 archetypeCatalog 设置为 URL:

http://maven.apache.org/archetype/maven-archetype-plugin/examples/generate-alternative-catalog.html

任何提示或指导我做错了什么?谢谢!

【问题讨论】:

在上面的例子中,myfaces.apache.org/archetype-catalog.xml 包含原型列表 可以帮我一个忙,试试 3.0.0 之前的版本吗?我假设你打到issues.apache.org/jira/browse/ARCHETYPE-519。 是的,我可以通过回到 2.4 来解决这个问题。感谢@Ducaz035 的提示 如果有人需要如何使用 v2.4 的示例,这里是:***.com/a/42252982/90101 【参考方案1】:

最新的 Maven 原型插件似乎有问题:

https://issues.apache.org/jira/browse/ARCHETYPE-519

这是上一版本的回归。

回到 2.4 解决这个问题。

【讨论】:

以上是关于执行 mvn archetype:generate with URL for 时未定义原型的主要内容,如果未能解决你的问题,请参考以下文章

使用mvn archetype:generate快速建立Maven项目目录结构

idea maven mvn archetype:generate 速度缓慢问题(转)

maven常用命令介绍

Maven常用的命令

转:maven常用命令介绍

maven管理整理