Maven plugins with the archetype plugin

In Chapter 5, Maven Plugins, we discussed in detail how to develop Maven plugins. However, in all of those cases, we started from scratch, building everything from the project structure to everything by hand. Now, we will look at how to create a Maven plugin project with the archetype plugin. Here, we use the maven-archetype-plugin:

$ mvn archetype:generate 
                  -DgroupId=com.packt.samples
                  -DartifactId=com.packt.samples.plugins.myplugin
                  -DarchetypeGroupId=org.apache.maven.archetypes
                  -DarchetypeArtifactId=maven-archetype-plugin
                  -DinteractiveMode=false

The previous command will produce the following directory structure and the source code. If you look at the pom.xml file, you will notice that it contains ...

Get Mastering Apache Maven 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.