maven archetype:generate does not find archetype in local catalog

Roland picture Roland · Aug 9, 2011 · Viewed 17.9k times · Source

I have created and installed my own archetype and now I am trying to create a new project with it with the command line. When I run

mvn archetype:generate -DarchetypeCatalog=local

I can see that the archetype is installed:

19: local -> myOwnArchetype (Archetype - my own archetype)

And in the archetype-catalog.xml I find

<archetype>
  <groupId>de.rm.trial</groupId>
  <artifactId>myOwnArchetype</artifactId>
  <version>1.0</version>
  <description>Archetype - my own archetype</description>
</archetype>

When I try

mvn archetype:generate -DarchetypeCatalog=local -DarchetypeGroupId=de.rm.trial -DartifactId=myOwnArchetype -DarchetypeVersion=1.0 -DgroupId=de.rm.trial.mynew -DartifactId=myNewProject

it still asking "Choose number:".

I found this link Specify archetype for archetype:generate on command line so I tried it with

mvn archetype:generate -DarchetypeCatalog=local -DarchetypeGroupId=de.rm.trial -DartifactId=myOwnArchetype -DarchetypeVersion=1.0 -DgroupId=de.rm.trial.mynew -DartifactId=myNewProject -DinteractiveMode=false

Unfortunately maven tells

[INFO] No archetype defined. Using maven-archetype-quickstart (de.rm.trial:maven-archetype-quickstart:1.0)

I have no more idea, what might be wrong with it?

Answer

Raghuram picture Raghuram · Aug 9, 2011

You have used artifactId instead of archetypeArtifactId. Try the following:

mvn archetype:generate -DarchetypeCatalog=local -DarchetypeGroupId=de.rm.trial -DarchetypeArtifactId=myOwnArchetype -DarchetypeVersion=1.0 -DgroupId=de.rm.trial.mynew -DartifactId=myNewProject -DinteractiveMode=false