执行 Maven archetype generate 命令创建 Opendaylight 项目结构时出错
Error executing Maven archetype generate command to create a Opendaylight project structure
当我执行此操作时:
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 原型来启动烤面包机。
感谢您的帮助。
这是我的行家信息:
➜ ~ 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
自 Maven Archetype Plugin 3.0.0 起,原型解析已更改。不再可能通过命令行指定存储库,而是使用已经为 Maven 指定的存储库。这意味着还尊重镜像和代理,以及对存储库的身份验证。
1.You 将删除 -DarchetypeCatalog & -DarchetypeRepository
2. 在你的.m2/setting.xml中添加
<settings>
<mirrors>
<mirror>
<id>mrm-maven-plugin</id>
<name>Mock Repository Manager</name>
<url>http://www.mycompany.com/maven-reporistory-manager</url>
<mirrorOf>*,!archetype</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>acme</id>
<repositories>
<repository>
<id>archetype</id>
<url>https://www.acme.com/repo</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>acme</activeProfile>
</activeProfiles>
</settings>
添加一个 id 为 archetype 的仓库:
<repository>
<id>archetype</id>
<url>https://repository.domain.com/path/to/repo/</url>
</repository>
就我而言,
<repository>
<id>archetype</id>
<url>http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
</repository>
基本上,我是不带-DarchetypeRepository 参数执行的,但是把它放在上面的settings.xml中。并将 -Darchetypecatalog 参数更改为 remote 或将其设置为空。有效。
最近的 Maven 版本不支持原型的命令行定义。因此,简而言之,您的默认设置文件应如下所示 (vi ~/.m2/setting.xml),
<?xml version="1.0" encoding="UTF-8"?>
<!-- vi: set et smarttab sw=2 tabstop=2: -->
<!--
Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http://www.eclipse.org/legal/epl-v10.html
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>opendaylight-release</id>
<repositories>
<repository>
<id>opendaylight-mirror</id>
<name>opendaylight-mirror</name>
<url>https://nexus.opendaylight.org/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>opendaylight-mirror</id>
<name>opendaylight-mirror</name>
<url>https://nexus.opendaylight.org/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>opendaylight-snapshots</id>
<repositories>
<repository>
<id>opendaylight-snapshot</id>
<name>opendaylight-snapshot</name>
<url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>archetype</id>
<url>http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>opendaylight-snapshot</id>
<name>opendaylight-snapshot</name>
<url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>opendaylight-release</activeProfile>
<activeProfile>opendaylight-snapshots</activeProfile>
</activeProfiles>
</settings>
如果您是因为在创建 Ninja
项目时收到此错误消息而来到这里,请下载最新版本的 Maven。(高于 2.5.2 的任何版本)。
此错误发生在低于 2.5.3 的 Apache Maven 版本
在使用 archetype Catalog 生成项目时指定特定的 maven archtype 插件版本(版本低于 3.x)
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeCatalog=<archetype-url>
当我执行此操作时:
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 原型来启动烤面包机。
感谢您的帮助。 这是我的行家信息:
➜ ~ 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
自 Maven Archetype Plugin 3.0.0 起,原型解析已更改。不再可能通过命令行指定存储库,而是使用已经为 Maven 指定的存储库。这意味着还尊重镜像和代理,以及对存储库的身份验证。 1.You 将删除 -DarchetypeCatalog & -DarchetypeRepository 2. 在你的.m2/setting.xml中添加
<settings>
<mirrors>
<mirror>
<id>mrm-maven-plugin</id>
<name>Mock Repository Manager</name>
<url>http://www.mycompany.com/maven-reporistory-manager</url>
<mirrorOf>*,!archetype</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>acme</id>
<repositories>
<repository>
<id>archetype</id>
<url>https://www.acme.com/repo</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>acme</activeProfile>
</activeProfiles>
</settings>
添加一个 id 为 archetype 的仓库:
<repository>
<id>archetype</id>
<url>https://repository.domain.com/path/to/repo/</url>
</repository>
就我而言,
<repository>
<id>archetype</id>
<url>http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
</repository>
基本上,我是不带-DarchetypeRepository 参数执行的,但是把它放在上面的settings.xml中。并将 -Darchetypecatalog 参数更改为 remote 或将其设置为空。有效。
最近的 Maven 版本不支持原型的命令行定义。因此,简而言之,您的默认设置文件应如下所示 (vi ~/.m2/setting.xml),
<?xml version="1.0" encoding="UTF-8"?>
<!-- vi: set et smarttab sw=2 tabstop=2: -->
<!--
Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http://www.eclipse.org/legal/epl-v10.html
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>opendaylight-release</id>
<repositories>
<repository>
<id>opendaylight-mirror</id>
<name>opendaylight-mirror</name>
<url>https://nexus.opendaylight.org/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>opendaylight-mirror</id>
<name>opendaylight-mirror</name>
<url>https://nexus.opendaylight.org/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>opendaylight-snapshots</id>
<repositories>
<repository>
<id>opendaylight-snapshot</id>
<name>opendaylight-snapshot</name>
<url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>archetype</id>
<url>http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>opendaylight-snapshot</id>
<name>opendaylight-snapshot</name>
<url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>opendaylight-release</activeProfile>
<activeProfile>opendaylight-snapshots</activeProfile>
</activeProfiles>
</settings>
如果您是因为在创建 Ninja
项目时收到此错误消息而来到这里,请下载最新版本的 Maven。(高于 2.5.2 的任何版本)。
此错误发生在低于 2.5.3 的 Apache Maven 版本
在使用 archetype Catalog 生成项目时指定特定的 maven archtype 插件版本(版本低于 3.x)
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeCatalog=<archetype-url>