Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error executing Maven archetype generate command to create a Opendaylight project structure

When I execute this:

 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

I got the following error:

[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]

And help1 looks like this:

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

which hasn't been update for a long time.

First, I removed backslash and whitespace, obviously it didn't work. I thought it may be the parameter of archetypeCatalog, so I ran this:

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

I got a error like this:

[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]

The tutorial mentions that OpenDaylight maintains its own repositories outside of Maven Central, which means maven cannot resolve OpenDaylight artifacts by default. So I did as tutorial with following command:

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

I even tried this:

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

The settings.xml files just look the same. I have seen some similar issues these days. As a noob of both maven and opendaylight, I have no idea about what to do next step? I just want to generate an opendaylight arachetype to start a toaster.

Thank you for your help. Here is my maven inforamtion:

 ➜  ~ 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"
like image 331
Oscar Zhang Avatar asked Apr 23 '17 11:04

Oscar Zhang


People also ask

What is the command to create a new project based on an archetype?

To create a new project based on an Archetype, you need to call mvn archetype:generate goal, like the following: mvn archetype:generate.

What is archetype while creating Maven project?

In short, Archetype is a Maven project templating toolkit. An archetype is defined as an original pattern or model from which all other things of the same kind are made. The names fits as we are trying to provide a system that provides a consistent means of generating Maven projects.


1 Answers

With maven-archetype-plugin 3.x it is not possible anymore to specify the repository as commandline argument (for consistency and security reasons).

So you have 2 options:

  • Follow the new instructions
  • Lock the version of the plugin to 2.4
like image 72
Robert Scholte Avatar answered Oct 06 '22 04:10

Robert Scholte