Error executing maven goal for Apache Camel with spring archetype - spring

I'm new to maven and I'm trying to create a Apache Camel project using maven. I ran the following maven command to run a maven goal (all in the same command line):
mvn archetype:generate
-DgroupId=com.mycompany.app –DartifactId=camel-first-app
–DarchetypeGroupId=org.apache.camel.archetypes –DarchetypeArtifactId=camel-archetype-spring -DinteractiveMode=false -X
I get a build failure from maven with an exception saying:
"org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory"
I'm doing this without having the POM.xml file in the current directory because in the Maven Guide it says you don't need one to begin with.

Related

How to build a maven scaffold like spring initializr

As the title, is there such a maven plugin that can achieve such a function, I can manually select the required dependencies, or even generate the code automatically?
There is https://code.quarkus.io/ for generating projects from the browser and also the quarkus https://quarkus.io/guides/cli-tooling if you want to use a command line application
You can create Maven project with mvn archetype:generate command. For example:
mvn archetype:generate -DgroupId=com.roamch007 -DartifactId=my-app -DinteractiveMode=false
This command will create project in may-app directory.
If you need specific dependencies you can create Maven Archetype, and re-use this archetype while generating new projects.
Read more: Guide to Maven Archetype

Teamcity Issue :Unable to add module to the current project as it is not of packaging type 'pom'

I am trying to add Maven build step in TeamCity to generate Maven archetype.
mvn archetype:generate
This works fine in command prompt.
Unfortunately it throws below error in TeamCity:
Failed to execute goal
org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate
(default-cli) on project pso-jms-listener-archetype:
org.apache.maven.archetype.exception.InvalidPackaging: Unable to add
module to the current project as it is not of packaging type 'pom'
I created a new folder and tried executing it there, but still throws the same error
Any suggestions would help.
You may already have a POM file in the directory where mvn archetype:generate is executed.
For Maven, 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.
In short, you are creating a project (from a template) in an other project.
In your project folder, delete the file pom.xml and use mvn archetype:generate again.

How to skip some java files from compilation in maven using command line?

I am using maven with jenkins. On eclipse the project build works fine. When I use jenkins I get the following error
[ERROR] /E:/jenkins/workspace/product/src/test/java/com/new/ftp/FTPTest.java:[102,55] package com.fasterxml.jackson.databind does not exist
The options for maven are as follows:
mvn clean install -X
I want to know if I can pass some arguements to maven to skip that package. I don't want to modify my pom.xml yet .
P.S - The project consists of a main pom.xml which calls other child modules.

running maven sonar from unix

I have a mvn project. I want to run it against sonar.
e.g. the following command - mvn org.codehaus.mojo:sonar-maven-plugin:2.0:sonar
Without going in and modifying the application pom file to add sonar plugin, is there another way that I can call the mvn command and reference sonar plugin ?
I don't know how it works, but if you execute it from Jenkins with the Sonar plugin it will work without modifying your pom.xml.

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!

Resources