http://maven.apache.org/archetype/maven-archetype-plugin/create-from-project-mojo.html
Description:
Creates an archetype project from the current project.
This goal reads your source and resource files, the values ofits parameters, and properties you specify in a.property file, and uses them to create a Mavenarchetype project using the maven-archetype packaging. If you buildthe resulting project, it will create the archetype. You can thenuse this archetype to create new projects that resemble theoriginal.
The maven-archetype-plugin uses Velocity to expand templatefiles, and this documentation talks about 'Velocity Properties',which are values substituted into Velocity templates. See TheVelocity User's Guide for more information.
This goal modifies the text of the files of the current projectto form the Velocity template files that make up the archetype.
-
GAV
- The GAV values for the current project are replaced by properties: groupId, artifactId, and version. The user chooses newvalues for these when generating a project from the archetype. package
- All the files under one specified Java (or cognate) package arerelocated to a project that the user chooses when generating aproject. References to the class name are replaced by a propertyreference. For example, if the current project's sources are in thepackage org.apache.saltedpeanuts, then any example ofthe string org.apache.saltedpeanuts is replaced withthe Velocity property reference ${packageName}. Whenthe user generates a project, this is in turn replaced by his orher choice of a package. custom properties
- You may identify additional strings that should be replaced byparameters. To add custom properties, you must use the propertyFile parameter to specify a property file. Seethe documentation for propertyFile for thedetails.
Note that you may need to edit the results of this goal. Thisgoal has no way to exclude unwanted files, or add copyright noticesto the Velocity templates, or add more complex elements to thearchetype metadata file.
This goal also generates a simple integration-test thatexercises the generated archetype.
Attributes:
- Requires a Maven project to be executed.
- Executes as an aggregator plugin.
- Invokes the execution of the lifecycle phase generate-sources prior to executing itself.
-
package
- See the packageName parameter. archetype.languages
- See the archetypeLanguages parameter. groupId
- The default groupId of the generated project. artifactId
- The default artifactId of the generated project. version
- The default version of the generated project. archetype.filteredExtensions
- See the filteredExensions parameter.
Custom properties allow you to replace some constant values inthe project's files with Velocity macro references. When a usergenerates a project from your archetype he or she gets theopportunity to replace the value from the source project.
Custom property names may not contain the '.'character.
For example, if you include a line like the following in yourproperty file:
cxf-version=2.5.1-SNAPSHOT
2.5.1-SNAPSHOT
cxf-version
cxf-version
requiredProperty
2.5.1-SNAPSHOT
- Type: java.io.File
- Required: No
- Expression: ${archetype.properties}
Usage:
[Run in a directory including pom.xml]
> mvn archetype:create-from-project
The archetype will be generated in */target/generated-sources/archetype