无法生成新的 Maven 项目

Can't generate the new Maven project

我正在关注来自 Red Hat 的 tutorial 并且我是 运行 Maven 中的查询:

mvn archetype:generate
-DarchetypeGroupId=io.fabric8.archetypes
-DarchetypeArtifactId=karaf-camel-cbr-archetype
-DarchetypeVersion=1.2.0.redhat-630187
-DgroupId=tutorial
-DartifactId=tx-jms-router
-Dversion=1.0-SNAPSHOT
-Dfabric8-profile=tx-jms-router-profile

但是我看到一个错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3
.0.1:generate (default-cli) on project standalone-pom: The desired archetype doe
s not exist (io.fabric8.archetypes:karaf-camel-cbr-archetype:1.2.0.redhat-630187
) -> [Help 1]

我尝试使用 Jboss Developer Studio 创建一个 maven 项目,但结果是一样的

如果你看here

...您会注意到工件不在中央 Maven 存储库中。 所以问题是你需要告诉 Maven 在非默认位置也查看。

因此,您需要编辑 settings.xml 并添加一个额外的存储库(在上面 link 中,您指向正确的存储库)。

https://maven.repository.redhat.com/ga/

编辑:与在 settings.xml 中添加存储库相关(与您在下面的评论相关)。您的列表有两处错误:

  • 您缺少 activeProfiles 标签 here(您只有 activeProfile
  • 事实上你错过了 activeProfiles 标签并且你没有遇到 Maven 错误,这让我相信你修改了错误的 settings.xml。您是否尝试修改 .m2 文件夹中的文件?

试试这个

-DarchetypeRepository=http://repo.open.iona.com/maven2