Using OpenDaylight starter archetype does not work - maven

Trying to follow the opendaylight developer tutorial to get an initial hello world application running on the controller, however running the command
mvn archetype: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
Results in an error
No plugin found for prefix ' -DarchetypeRepository=https' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/andrew/.m2/repository), opendaylight-snapshot (https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/), opendaylight-mirror (https://nexus.opendaylight.org/content/repositories/public/), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
I've managed to get it to succeed using the command
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (default) on project test-impl: You have 1 Checkstyle violation. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (default) on project test-impl: You have 1 Checkstyle violation. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
Any ideas how to resolve this (or other ways of getting a first app)?

From this link, you can use the following command :
mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype \
-DarchetypeRepository=http://nexus.opendaylight.org/content/repositories/<Snapshot-Type>/ \
-DarchetypeCatalog=remote -DarchetypeVersion=<Archetype-Version>
while replacing Snapshot-Type and Archetype-Version as follows:
Using this search on ODL's Nexus repository:
For the Oxygen dev snapshot use Snapshot-Type=opendaylight.snapshot and Archetype-Version=1.5.0-SNAPSHOT
For the Nitrogen SR1 snapshot use Snapshot-Type=opendaylight.snapshot and Archetype-Version=1.4.1-SNAPSHOT
For the Nitrogen release use Snapshot-Type=opendaylight.release and Archetype-Version=1.4.0
For the Carbon use Snapshot-Type=opendaylight.release and Archetype-Version=1.3.0-Carbon
For Boron SR0 use Snapshot-Type=opendaylight.release and Archetype-Version=1.2.0-Boron
For Boron SR1 use Snapshot-Type=opendaylight.release and Archetype-Version=1.2.1-Boron-SR1
For Boron SR2 use Snapshot-Type=opendaylight.release and Archetype-Version=1.2.2-Boron-SR2
For the Boron snapshot use Snapshot-Type=opendaylight.snapshot and Archetype-Version=1.2.2-SNAPSHOT
You can also see this answer.

I have found a solution in the OpenDaylight forum.
Please remove
-DarchtypeCatlog=http://nexus.opendaylight.org/content/repositories/opendaylight.release/archetype-catalog.xml
and execute following command.
mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeRepository=http://nexus.opendaylight.org/content/repositories/opendaylight.release -DarchetypeVersion=1.4.0

Related

build-helper-maven-plugin: Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.2:set

We have a project and in the pom.xml we did not specify the groupId becuase we inherit it from the parent pom.
If we then run mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}, we get an error:
[ERROR] Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.2:set (default-cli) on project dbutils: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.2:set failed. NullPointerException -> [Help 1]
I checked this is a bug from the maven versions plugin and there are workarounds e.g., using 2.1 instead of 2.2.
Do you know, how can I avoid this error using the build-helper plugin?
Thank you,
Yashu
Thanks to #khmarbaise, I can specify the versoin of versions-maven-plugin:
mvn -B build-helper:parse-version org.codehaus.mojo:versions-maven-plugin:2.4:set

Failure building Spring Boot 1.5.4.RELEASE from source

I would like to build spring-boot 1.5.4.RELEASE. To do that I use the command
./mvnw clean install -U -Dmaven.test.skip=true -DskipTests=true
but I got the following problem (see below).
[ERROR] Failed to execute goal on project spring-boot-test: Could not resolve dependencies for project org.springframework.boot:spring-boot-test:jar:1.5.4.RELEASE: Could not find artifact org.springframework.boot:spring-boot:jar:tests:1.5.4.RELEASE in spring-ext (http://repo.spring.io/ext-release-local/) -> [Help 1]
How can I solve this issue?

Manual dependency Maven and Jenkins

I have created a Job in Jenkins with some goals in Maven (clean verify compile).
But, when I run the Job has the error:
[ERROR] Failed to execute goal on project NameProject: Could not resolve dependencies for project NameProject:x:war:0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.oracle:ojdbc14:jar:10.2.0.5, org.primefaces.themes:sentinel-theme:jar:2.1.2: Could not find artifact com.oracle:ojdbc14:jar:10.2.0.5 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
I have created manual dependency in Maven
mvn install:install-file
-Dfile=<path-to-file>
-DgroupId=<group-id>
-DartifactId=<artifact-id>
-Dversion=<version>
-Dpackaging=<packaging>
-DgeneratePom=true
,but Jenkins doesn't know this dependency in the pom.
When I execute verify compile in Maven it's works!, But when I execute in Jenkins doesn't work.
If you want to install it into a local repository, you need to install it into the local repository that is used by the Jenkins Server,i.e. you need to start mvn install on the Jenkins server.
If you have a company Nexus server, it is probably better to install it there.
I have changed the default local repository Maven
<localRepository>C:/Users/nameUser/.m2/repository</localRepository>
My Maven diretory was in a another drive (E:/), when repository in (C:).

maven error: The desired archetype does not exist (org.phpmaven:php5-web-archetype:2.0-SNAPSHOT)

I am trying to create php project using maven by tying below command:
sudo mvn archetype:generate -DarchetypeGroupId=org.phpmaven
-DarchetypeArtifactId=php5-web-archetype -DarchetypeVersion=2.0-SNAPSHOT
-DgroupId=org.sample -DartifactId=my-app -Dversion=0.0.1-SNAPSHOT
but it gives me error:
Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli)
on project standalone-pom: The desired archetype does not exist (org.phpmaven:php5-web-archetype:2.0-SNAPSHOT) -> [Help 1]
Apparently you're trying to follow these instructions. If you do, you should also do the preparation steps that have been listed.
Doing that you're relying on a snapshot archetype, and those do not exist in default repositories, so you have to configure php-maven snapshot repository.
After doing that,
Confirm your settings.xml location (in the comments you indicated you had that in the wrong folder)
try with
mvn archetype:generate -DarchetypeGroupId=org.phpmaven.sites
-DarchetypeArtifactId=php5-web-archetype -DarchetypeVersion=2.0.0-beta-1
-DgroupId=org.sample -DartifactId=my-app -Dversion=0.0.1-SNAPSHOT
Since you can see from the repo that that archetype version should be in place. Note the different archetypeversion and different archetypegroupid!

"Error reading POM" when selecting a archetype in Maven setup

I downloaded maven 3.0.3, set-up my environment variables as instructed and verified with mvn --version that everything looks ok. So far so good
So, time to RTFM.. about 1 minute into the manual, weirdness occurs.
mvn archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DgroupId=com.mycompany.app \
-DartifactId=my-app
It asked me to select a archetype from this long list, I took the quickstart one 135.
However, this doesn't work.. it spits out the following error:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-archetype-plugin:2.1:generate
(default-cli) on project standalone-pom: Error reading POM -> [Help 1]
What am I doing wrong?
Up-to-date documentation: the free book by Sonatype. I learned some stuff from there even after using Maven for over 3 years.

Resources