Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify archetype for archetype:generate on command line

I'm generating a Maven archetype for a simple project. I use archetype:generate, and it gives me a list of types of archetypes to generate. I'm pretty sure I want

99: remote -> maven-archetype-quickstart (An archetype which contains a sample Maven project.)

I can just enter "99" interactively, but I'm trying to write a blog post. I don't want to tell my readers "search for maven-archetype-quickstart in the hundreds of options", and I know it won't always be number 99.

So, how do I specify on the command line the archetype to generate?

(A similar question discusses which archetype to use, but not how to specify it non-interactively)

like image 830
Ron Romero Avatar asked Feb 05 '11 20:02

Ron Romero


People also ask

Which of the command is used to generate maven archetype?

To create an archetype manually, we can start with a newly created Maven project and then we can add the resources mentioned above. Or, we can generate it by using the archetype-maven-plugin, and then customize the content of the archetype-resources directory and archetype-metadata. xml file.

What is the command to create a new project based on an archetype commandline?

To create a new project based on an Archetype, you need to call mvn archetype:generate goal, like the following: mvn archetype:generate.


1 Answers

You can provide arguments via system properties, as in:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

like image 137
McDowell Avatar answered Oct 05 '22 11:10

McDowell