Search code examples
mavenmaven-archetype

How maven know which archetype is used?


I am wonder how maven know which archetype is used for specified pom.xml

I didn't find any difference between pom.xml of maven-archetype-quickstart and that of maven-archetype-webapp.


Solution

  • These are two different Questions:

    I am wonder how maven know which archetype is used for specified pom.xml

    The archetype plugin is usually used interactively. You just call mvn archetype:create, and the wizard walks you through the different steps. There's nothing you need to configure in a pom. In fact it would be silly to put archetype information in an existing project, as archetypes are for creating new projects.

    I did not found any difference between pom.xml of maven-archetype-quickstart and that of maven-archetype-webapp.

    The main difference is that webapp contains a folder src/main/webapp which contains your static web resources and the WEB-INF folder. Also, the packaging is set to war. So maven-archetype-quickstart is the default for creating a simple jar project, while maven-archetype-webapp is the default for creating a simple war project.