Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between mvn archetype:generate and mvn archetype:create

any difference between those two?

like image 493
user496949 Avatar asked Mar 06 '11 07:03

user496949


People also ask

What is mvn archetype generate?

Full name: org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate. Description: Generates a new project from an archetype, or updates the actual project if using a partial archetype. If the project is fully generated, it is generated in a directory corresponding to its artifactId.

What are the different Maven archetypes?

Provided ArchetypesAn archetype to generate a simplifed sample J2EE application. An archetype to generate a sample a sample Maven plugin. An archetype to generate a sample Maven plugin. An archetype to generate a sample Maven plugin site.

What archetype should I use Maven?

If you want a web application, use maven-archetype-webapp, or if you want a simple application use maven-archetype-quickstart. They are useful because you will be able to expand them with no problem. Note that this is in the Eclipse plugin by default (at least it is today).

Which command generates an archetype from an existing Maven project?

Maven provides the ability to create an Archetype from an existing Maven project by running mvn archetype:create-from-project . It will analyze your project pom.


2 Answers

archetype:create is the old and deprecated form that needed all properties defined upon start, while archetype:generate is the newer and more comfortable way. archetype:generate knows about those catalogs where archetypes are listed and can ask you for missing properties/variables.

I guess the reason for introducing a new command was that the new generate was not backward-compatible, so it might have broken existing scripts that rely on it.

like image 77
Boris Avatar answered Sep 28 '22 17:09

Boris


Check the documentation for archetype generate, create has been kept for backwards compatibility:

For backward compatibility with the Archetype Plugin version 1.0-alpha-7, we kept the old create goal which can be called using mvn archetype:create.

So create and generate will do the same thing but create has been deprecated so you should use the generate command instead.

like image 25
krock Avatar answered Sep 28 '22 16:09

krock