Create a Maven archetype from an existing project on Eclipse

First, a mvn archetype:create-from-project and a mvn install on the created archetype in target/generated-sources/archetype directory.

A directory, named ${groupId}/${artifactId}-archetype, containing a jar and pom.xml is generated into the repository.

A mvn archetype:crawl -Drepository=/path/to/.m2 is then used to generate the archetypes catalog. The archetype-catalog.xml file is by default generated in .m2/repository (this can be changed while using the parameter -Ddirectory=/path/for/xml)

Finally, in Eclipse, go to Window > Prefences > Maven > Archetypes > Add local catalog, enter the name and directory of this catalog.

When you create a new Maven project on Eclipse, you can select your ${groupId}/${artifactId}-archetype in your catalog freshly named.

More on :

http://maven.apache.org/plugins/maven-archetype-plugin/advanced-usage.html

Maven webapp on Eclipse with Tomcat

I finally did it !!!!!!!!!!!!

I manage to configure a Maven webapp to run on a Tomcat Server to test the JSPs on Eclipse.

.: To Complete :.

1. Create a library for Tomcat JARs
Window > Preferences > Java > Build Path > User Libraries

2. Add this library to classpath with maven-eclipse-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.3</version>
<configuration>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.USER_LIBRARY/Tomcat-6.0.20</classpathContainer>
</classpathContainers>

</plugin>

A big thank to that site

http://www.devx.com/Java/Article/36785/1763/page/3

Let’s code then 😀