Monday, March 19, 2018

Create Custom Maven ArcheType


https://github.com/sapan-s2/custom-ArcheType

Steps :


  • Generate Archetype


mvn archetype:generate -B -DarchetypeArtifactId=maven-archetype-archetype  -DgroupId=com.MyCompany.archetype -DartifactId=Test-ArcheType -Dversion=1.0-SNAPSHOT


  • Rename archetype.xml to archetype-metadata under META-INF/maven(it;s autogenerated by the above command)

  • Now Add your default directory structures needed for this ArcheType

In order to use this ArcheType to create a new Project

mvn archetype:generate -DarchetypeCatalog=local
-DarchetypeArtifactId=<new-app-Artifact-name>
-DarchetypeGroupId=<new-app-group-id>
 -DarchetypeVersion=<version>

ex - mvn archetype:generate -DarchetypeCatalog=local
 -DarchetypeArtifactId=Test-ArcheType
-DarchetypeGroupId=com.MyCompany.archetype 
-DarchetypeVersion=1.0-SNAPSHOT







Refrences:
https://maven.apache.org/plugins-archives/maven-archetype-plugin-1.0-alpha-7/examples/archetype.html

https://maven.apache.org/guides/mini/guide-creating-archetypes.html



No comments:

Post a Comment