Maven Java EE 6 application

How to create a Java EE 6 Maven application in Eclipse and run it using embedded Tomcat?

How to create a Java EE 6 Maven application in Eclipse?

 

First make sure you have up-to-date Maven central index in Eclipse. Goto Window -> Show View -> Other -> Maven Repositories, select Global Repositories -> central, right click and choose Rebuild Index.

 

After it's done, create a new Maven project (using File -> New -> Other -> Maven Project), don't skip archetype selection, select project with artifactId webapp-javaee6 and create a Maven project. 

 

To create a WAR file, run goal package.

 

To run this application using embedded Tomcat server open pom.xml and add plugin tomcat7-maven-plugin. Next run goal tomcat7:run. Open browser and you will see contents of index.jsp file.

 

This plugin maven-dependency-plugin is useless, so you can delete it.