Is it possible to create an application specific archetypes using an existing 'Generic' archetype?.
Generic Archetype - would contain the generic folders and config files etc. Extend the existing archetype to the child archetype.
Generic Archetype ---> Specific App Archetype (Keep app specific folders..)
Generic Archetype ---> Specific App Archetype 1
Every time when we create a project using application specific archetype should check for new updates in Generic archetype.
Archetype configuration You can see the packaging maven-archetype . You can customize build of your archetype here as with any other pom. However, there is another pom. xml file located under src\main\resources\archetype-resources which is the pom file of the generated project.
In short, Archetype is a Maven project templating toolkit. An archetype is defined as an original pattern or model from which all other things of the same kind are made. The name fits as we are trying to provide a system that provides a consistent means of generating Maven projects.
The Maven archetype descriptor is the heart of the archetype project. It's an XML file named archetype-metadata. xml and located in the META-INF/maven directory of the jar. The requiredProperties tag is used for providing properties during project generation.
If you want a web application, use maven-archetype-webapp, or if you want a simple application use maven-archetype-quickstart.
For me, you have two main choices :
You can create your own archetype from nothing. Here is the official guide. You have few steps to follow (create a pom.xml, an archetype.xml,...).
You can create an archetype from an existing project folder. For example, first, you can create a project from a Maven archetype (like "maven-archetype-webapp") of a web application. Then, you make your changes (add or modify some configuration files, create a folder for a specific purpose, etc.). And finally, you can create you own archetype, from this project, executing this command line :
mvn archetype:create-from-project
A mini guide to create an archetype from a existing project.
Reference doc to create an archetype from a existing project (mojo infos)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With