java – 执行Maven archetype generate命令以创建Opndaylight项目结构时出错

当我执行这个:

 mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype \
-DarchetypeRepository=http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ \
-DarchetypeCatalog=http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/archetype-catalog.xml

我收到以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli) on project standalone-pom: archetypeCatalog 'http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/archetype-catalog.xml' is not supported anymore. Please read the plugin documentation for details. -> [Help 1]

而help1看起来像这样:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

这已经很久没有更新了.

首先,我删除了反斜杠和空格,显然它没有用.
我以为它可能是archetypeCatalog的参数,所以我运行了这个:

mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeCatalog=remote -DarchetypeVersion=1.1.2-Beryllium-SR2

我收到这样的错误:

[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 does not exist (org.opendaylight.controller:opendaylight-startup-archetype:1.1.2-Beryllium-SR2) -> [Help 1]

该教程提到OpenDaylight在Maven Central之外维护自己的存储库,这意味着默认情况下maven无法解析OpenDaylight工件.
所以我用以下命令做了教程:

cp -n ~/.m2/settings.xml{,.orig} ; \ wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml

我甚至试过这个:

cp -n ~/.m2/settings.xml{,.orig} ; \ wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/stable/beryllium/settings.xml > ~/.m2/settings.xml

settings.xml文件看起来一样.
这些天我见过一些类似的问题.作为maven和opendaylight的菜鸟,我不知道下一步该做什么?我只想生成一个opendaylight arachetype来启动烤面包机.

谢谢您的帮助.
这是我的maven信息:

 ➜  ~ mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /usr/local/Cellar/maven/3.5.0/libexec
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.6", arch: "x86_64", family: "mac"

解决方法:

使用maven-archetype-plugin 3.x,不可能将存储库指定为命令行参数(出于一致性和安全性原因).

所以你有两个选择:

>关注the new instructions
>将插件的版本锁定为2.4

上一篇:php部分--题目:投票


下一篇:Json格式的netconf转成NormalizedNode