Professional Documents
Culture Documents
MAKE CUSTOM
ARCHETYPE
By Martin Nad
martin_m_nad@yahoo.com
OVERVIEW
Here I discuss little about Maven2 and show step by step how
you can create your own Archetype.
TABLE OF CONTEXT:
Maven2 How to make
custom archetype
• Under construction
• Maven
• Maven as project oriented mangment give us different
posibility to make /maintance a project easier
• Maven has two basic function
• 1-goles and2- pom
• Goles are about build a project (verb)
• And pom is a decrative description of a project in a xml-
file pom.xml (nounce)
• Maven has many benifites as:
• ......
• And you can create or define your archetype
• What is archetype
• As we know there are lot of the veriouse archetype with
Maven and we can use one of them when we need it.
• Maven archetype helps us to save lot of time to make a
new class hierachy everytime that we make a new
project.
For each time if you want make a new application from
scrutch to the a working example, it should take lot of the
time. To make all class hierachy and load all java packages
and so on.
It is very often when you make an application, you can use
almost up to 100% of application structure, and here you can
get help of mave.
• The most simplest archtype in Mave is maven-archetype-
site-simple and the other archetype i ususally to use to
make for a webapplication is: maven-archetype-webapp.
But there are missing lot of class-hirechy in this
archetype that i should make those folder and classess
manaully. For example it is missing for java-folder under
src/main.
• When you can make your own archetype you are able
once define a archetype and use it in serveral time
exactly the same archetype.
• But there are missing lot of different case that you may
want those archetype for example if you want use
Hibernate with the Spring and so on.
• How to make archetype
• If you have already worked with maven, and certenly you
have, you should be familyer with archetypes and
hirerchey in maven.
• Acctully i use Eclips right now, and in this tutorial i will
show you how you can create your own define archetype
very easy and very fast.
• For a very simple case you can very easily make very fast
your archetype as follows:
• First assume that you have a very simple archetype or
make a new application as follows:
$ mvn archetype:create
-DarchetypeGroupId=org.apache.maven.archetypes
-Darchety
peArtifactId=maven-archetype-quickstart
-DgroupId=myMultiProjectGroupId -Dartif
actId=myMultiProjectArtifactId -DpackageName=
-Dversion=1.0
Now you have a empty application and when you are finished
here you can make a new archetype from your application by
running this command:
$ mvn archetype:create-from-project
and when you are finished you can run this command to make
install your archetype in your local repository
$ mvn install
$mvn archetype:generate -DarchetypeCatalog=local
and now you can reuse your new archetype very easily from
Eclipse or by the mvn command.
That was all.
• First step
• You should have thism hierarchy in your archetype:
•
•
DONATION