Every time a maven web project is created, it is always generated according to maven-archetype-webapp, and then some tedious configuration is made. Maven-archetype-weapp’s current version is still 1.0, probably due to historical reasons, and in fact it is no longer able to meet the current needs. So let’s create our own maven-archetype-webapp.
There are two ways to create maven archetype:
Using the maven-archetype-plugin plug-in to export based on the existing project skeleton
Custom archetype description file
In this article, we explain the first and simplest method:
Suppose I now create a basic webapp project based on maven-archetype-webapp 1.0 provided by eclipse, and then do some configuration on this basis, depending on your own situation.
Above is the catalog structure of my project scaffolding.
Enter the project root directory I just created: E: eclipse-mars workspace maven-webapp
Run the following command：
At this point, the archetype we created has been created.
At this point: E: eclipse-mars workspace maven-webapp target generated-sources archetype is the root directory of the Maven archetype we created.
Enter the root directory of archetype and run MVN install to install it.
At this point, if we create a new Maven project in eclipse, we can see the Maven archetype we just created.