Search code examples
javamavenmaven-archetype

Maven Archetype: How to add more than one archetype in same maven-plugin?


I have a maven plugin to setup a custom archetype, whose code can be found here on github.

Now, I need to add another archetype whose pom file has an extra dependency. Other than that, only a few resource files differ. I need to re-use the tasks defined for the existing archetype.

Do I need to create a different plugin to create this archetype? How can i have multiple archetypes under same group?

P.S. I'm new to Maven world.

Thank you


Solution

  • Here is how I could do it:

    Multiple archetypes can be created under same group, for a particular maven plugin. A maven archetype template can be created with

    mvn archetype:generate
    

    More details can be found here.