Table Of Contents
Why
Use a template project structure in order to speed up your project definition such as packages, dependencies and relationship between classes.
How to build
To build an archetype you should follow the rules
The packing of project should be maven-archetype
Create a file archetype-metadata.xml under the folder src/main/resources/META-INF/maven.
This file is responsible to move the files classes, folders etc.The folder src/main/resources/archetype-resources should have all files to be generated by this archetype.
Structure
Below look the structure desired
After open the project generated you can check the classes packages and so on
Benefits
- The benefits of using a archetype as said before is speed up your project creation but also to maintain the projects with the same structure and avoid copy and paste of files.
How to run?
use the maven to build your archetype and for that execute the command
mvn instal
for instanceOnce your template is created it's time to create your project with the template
mvn archetype:generate -DgroupId=com.mynewcompany -DartifactId=new-project -DarchetypeGroupId={from your archetype project} -DarchetypeArtifactId={from your archetype project}
References
https://github.com/luizgustavocosta/maven-archetype-costa-luiz
https://maven.apache.org/guides/introduction/introduction-to-archetypes.html
https://pixabay.com/photos/blueprint-ruler-architecture-964629/
Top comments (0)