0

I'm running 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

And I got this 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]

But I could open this link('http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/archetype-catalog.xml') on web.

After I remove last option as this:

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

There is no error, but the result as bellow is not as expect as.

So how to use "-DarchetypeCatalog=http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/archetype-catalog.xml" in maven?

Thank you~

Attach information:

gateway@gateway-20150605:~/workspace/toaster2$ mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /usr/local/apache-maven
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk1.8.0_121/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-30-generic", arch: "i386", family: "unix"
batmancn
  • 457
  • 3
  • 15

3 Answers3

1

Configure your settings.xml as shown below, basically I added the ODL repo.

<?xml version="1.0" encoding="UTF-8"?>
<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>downloadSources</id>
            <properties>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>true</downloadJavadocs>
            </properties>
        </profile>
        <profile>
            <id>opendaylight-release</id>
            <repositories>
                <repository>
                    <id>opendaylight-mirror</id>
                    <name>opendaylight-mirror</name>
                    <url>http://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>http://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>http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>opendaylight-snapshot</id>
                    <name>opendaylight-snapshot</name>
                    <url>http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
        <profile>
            <id>maven-central-repo</id>
            <repositories>
                <repository>
                    <id>cetral-repo</id>
                    <name>maven-central-repo</name>
                    <url>http://repo1.maven.org/maven2/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>cetral-repo</id>
                    <name>maven-central-repo</name>
                    <url>http://repo1.maven.org/maven2/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>

    <activeProfiles>
        <!-- <activeProfile>maven-central-repo</activeProfile> -->
        <activeProfile>opendaylight-snapshots</activeProfile>
        <activeProfile>opendaylight-release</activeProfile>
        <activeProfile>downloadSources</activeProfile>
        <activeProfile>maven-central-repo</activeProfile>
    </activeProfiles>
</settings>

And in archetypeCatalog you do not provide URL, you need to provide remote, local or internal, though its optional below is the updated mvn command. Check here for more on archetypeCatalog parameter

mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeVersion=1.4.0-SNAPSHOT
Karthik Prasad
  • 9,662
  • 10
  • 64
  • 112
0

Try with:

mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller
  -DarchetypeArtifactId=opendaylight-startup-archetype \
  -DarchetypeCatalog=remote \
  -DarchetypeVersion=<whatever your version is>

and adjust your settings.xml file to with a new repository named archetypes. I found this when reading through the maven documentation. Sorry, but I don't the exact pointer at hand.

I fear the ODL community has not yet updated their settings.xml and we have to do it ourselves.

0

Specify the maven version when building the project, as following:

mvn org.apache.maven.plugins:maven-archetype-plugin:3.0.0:generate \
-DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype \
-DarchetypeRepository=https://nexus.opendaylight.org/content/repositories/public \
-DarchetypeCatalog=https://nexus.opendaylight.org/content/repositories/public/archetype-catalog.xml \
-DarchetypeVersion=1.2.2-Boron-SR2
Draken
  • 3,134
  • 13
  • 34
  • 54