Book Image

Mastering Apache Maven 3

Book Image

Mastering Apache Maven 3

Overview of this book

Table of Contents (16 chapters)
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Building a custom archetype


So far in this chapter, we have discussed several applications of Maven archetypes. It's high time now to build our own custom archetype. Let's see how to develop a Maven archetype for an Apache Axis2 module/handler. Let's start with a simple Maven project:

$ mvn archetype:generate
              -DgroupId=com.packt.axis2
              -DartifactId=com.packt.axis2.archetype.handler
              -Dversion=1.0.0 
              -Dpackage=com.packt.axis2.archetype.handler
              -DinteractiveMode=false

This command will generate the following directory structure:

com.packt.axis2.archetype.handler
                  |-pom.xml
                  |-src
                  |-main/java/com/packt/axis2/archetype/handler/App.java
                  |-test/java/com/packt/axis2/archetype/handler/AppTest.java

Before creating the archetype, first we need to build the project template. In this case, the project template itself is an Axis2 module/handler. Let's see how to improve...