Add Maven Archetype
Updated at 16856760760001. Introduction
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. Archetype will help authors create Maven project templates for users, and provides users with the means to generate parameterized versions of those project templates.
2. Add a maven archetype
We provide 2 maven archetypes - maven-simple-archetype: a template for Java 8 maven project, ezyfox-server-archetype: a template for ezyfox-server project
2.1 Add a maven archetype on eclipse
Let’s say you want to add maven-simple-archetype version 1.0.2 to Eclipse Step 1. Open eclipse, click File -> New -> Others. Select Maven project and click next and next to Select and Archetype step, If don’t know how to create a maven project, please read this guilde Step 2. After step 1, we will get a popup:
Click to Add Archetype button, and we get:
Fill information follow:
Id: com.tvd12 Artifact Id: maven-simple-archetype Version: ${mavenSimpleArchetypeVersion} URL: Empty
Click OK and we get:
Ok, done, you can use maven-simple-archetype to create maven project in eclipse from now.
2.2 Add a maven archetype on Intellij
Step 1. Like Eclipse, we open Intellij, click File->New->Project
, get the popup and select maven on left side take a look if you want to know more about maven project creation on Intellij)
Step 2. Tick to Create from archetype and click Add Archetype button, we get:
Fill information follow:
Id: com.tvd12 Artifact Id: maven-simple-archetype Version: 1.0.2 URL: Empty
Click OK and we get:
If you have already done above steps and nothing happend, so maybe your IntelliJ has a problem. You will need add Maven Archetype Catalogs Plugin
And then, let point to Maven Archetype Catalogs setting and add an URL to: https://repo.maven.apache.org/maven2/archetype-catalog.xml like this:
Ok, done, you can use maven-simple-archetype to create maven project in Intellij from now.
3. Conclusion
Maven Archetype help you pack all in one template and help you save a lot of time to setup maven project, and we also provide 2 maven archetypes:
- maven-simple-archetype: a template for Java 8 maven project.
- ezyfox-server-archetype: a template for ezyfox-server project.