11

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)

Community
  • 1
  • 1
Ron Romero
  • 9,211
  • 8
  • 43
  • 64
  • Yeah! +1 for this question. That is not documented in the tutorial, and I need a terminal with >9000 rows of backlog in order to search all the alternatives: no pager support! – Dacav Dec 14 '12 at 12:02

1 Answers1

15

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

McDowell
  • 107,573
  • 31
  • 204
  • 267
  • 3
    +1. Note: if one wants to generate the *maven-archetype-quickstart* project, then `-DarchetypeArtifactId=maven-archetype-quickstart` can be omitted, because it is the **default** project. – informatik01 Oct 07 '13 at 00:03