Reputation: 51
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.
Upvotes: 5
Views: 2656
Reputation: 498
I have gone through this one and it took me a half hour to find the proper solution. Here I want to share for those who come later.
After executing mvn archetype:generate -DgroupId=yourGroupId -DartifactId=yourArtifactId
or just mvn archetype:generate
, you should redirect to the parent project, and open the pom.xml
file, and then add the <packaging>pom</packaging>
to it. after that, you can add as many sub-modules as you want without any problems.
Upvotes: 0
Reputation: 346
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.
Upvotes: 3