Apache Maven Archetypes
What is the point?
One of the major goals in programming is to harbor re-usability and scalability.
One way we can reuse code is by creating a templating system that allows
you to quickly get up and running with predefined code that you're confident in.
Maven archetypes are one example of this system in action.
How do I create my own?
You can create your own Maven Archetype by using a Maven Archetype! Using the predefined
org.apache.maven.archetypes:maven-archetype-archetype. Make sure you choose the archetype from
Maven Central, as it has the most up-to-date version. You can also safely delete the test directory of the root folder
as this is simply a demonstration. Once you've done that, you can expect the following project structure:
my-archetype/
|-- src/
| |-- main/
| | |-- resources/
| | | |-- archetype-resources/
| | | | |-- src/
| | | | |-- main/
| | | | |-- java/
| | | | | |-- App.java
| | | | |-- test/
| | | | | |-- TestApp.java
| | | |-- META-INF/
| | | |-- maven/
| | | |-- archetype-meta.xml
| | |
| | |-- pom.xml
|-- pom.xml