Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven archetype:generate does not find archetype in local catalog

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?

like image 425
Roland Avatar asked Aug 09 '11 09:08

Roland


People also ask

How to install an archetype in Maven?

For doing so, you need to install the archetype by using the following command: After that, you will be able to use your new archetype while creating a new Maven project with the mvn archetype:generate command.

What is the Maven-archetype-plugin?

The maven-archetype-plugin allows the user to create a Maven project through the generate goal and existing archetype. For more information on this plugin, you can visit the homepage.

How to create an archetype manually?

How to Create an Archetype An archetype is a normal Maven project with the following extra content: To create an archetype manually, we can start with a newly created Maven project and then we can add the resources mentioned above.

What is requiredproperties tag in Maven?

It's an XML file named archetype-metadata.xml and located in the META-INF/maven directory of the jar. It's used to describe archetypes' metadata: The requiredProperties tag is used for providing properties during project generation. Thus, we'll be prompted to provide values for them, with the choice to accept the default value.


1 Answers

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
like image 134
Raghuram Avatar answered Oct 02 '22 20:10

Raghuram