Generate Maven2 Archetype from existing project
It's not hard to create custom archetype in Maven 2.2 from existing project. I had multi-module .ear Maven project which I want to reuse. So, I decided to play a little with custom archetypes to create my own and don't repeat myself again and again. Fixing dependencies manually - is not the best way to spend lifetime :)
To jumpstart archetype creaton there is a special maven goal of archetype plugin archetype:create-from-project. So,
mvn clean archetype:create-from-projectNow we have prototype of our archetype in target\generated-sources\archetype\ directory.
Then...
cd target\generated-sources\archetype\Friendly speaking, I had to do some tweaking to successfully generate normal .ear Maven 2 project which can be compiled and run without problems. It was fixing some of dependencies at Logic and EAR modules, bit it was not hard - just specifying ${groupId} where necessary. To use this archetype after "mvn install" just type
mvn install
mvn archetype:generateand choose EnterpriseApp-archetype from the list. It will looks like....
2: local -> EnterpriseApp-archetype (EnterpriseApp-archetype)in the list.
....
Source code is here : http://ostas-blog-src.googlecode.com/svn/trunk/JbossCargoJpaEjbWebEarArchetype/.
To build it use
svn co http://ostas-blog-src.googlecode.com/svn/trunk/JbossCargoJpaEjbWebEarArchetype/You'll need to specify your jboss home location at parent pom.xml file to use cargo-jboss deployment. In my case it is
mvn install
If you have any comments/issues/suggestions give me to know.<jboss.home>C:/server/Java/jboss-4.2.2.GA/</jboss.home>
