Many of them are functional project prototype/Skeleton Generation tools, but in the end, Maven archetypes with simple functions gradually have a unified hope.
Without it, you can easily clean up yourself and use it as an "official" younger brother of Maven, and then there are some other Jianghu bosses (appfuse, strust2, cxf) the example is the top-level tips.
Like many generation tools, Maven archetypes replaces variables from the velocity template and extends the directory structure of java files based on the package name.
Advanced usage describes a full Maven archetype cycle:
- MVN archetype: Create-from-project generates an archetype template from an existing project to target/generated-sources/archetype.
This still requires the program to be a little clever. Find the package name and variable, convert the variable into a symbol, and shrink the directory structure.
- Go to the directory and install the archetype template in MVN install to the local Maven repository.
- In the new directory, MVN archetype: generate-darchetypecatalog = Local, interactive input project name, package name, and other variables are used to generate a project.
Here, the 2.0 alpha3 version is much better than the original 1.0 alpha7 version. First, there are commands for crawling out templates from existing projects, and second, there is interactive input when generating projects, third, improvement of control files (support for ant syntax batch definition ).
For the new control file, see META-INF/Maven/archetype-metadata.xml. The original version 1.0 file has been voided.
The control file can add its own variables to control whether the directory needs to replace the variables with velocity, and whether to extend the directory tree according to the package name.
For details, see how metadata on an archetype is stored in the FAQ?