Create a Dynamic Web Project in Eclipse using Maven

Maven is a project management tool popular among programmers and project mangers alike. If configured correctly it enables you and your dev team to build (and run) a project regardless of the IDE that was used to develop it. It does this by automatically pulling in the required dependencies (that is, after they were set up correctly in the pom.xml). 

Maven can also be used the other way around, however, for it’s easy to generate an Eclipse project from a Maven project using:

mvn eclipse:eclipse

This command generates a general Java project with the required dependencies (JARs) in the project’s classpath.

Dynamic Web Project

You will notice that if the project is actually a Dynamic Web Project (WTP), e.g. a JSP or webservice project, it may not be as convenient to get it configured correctly in Eclipse (like setting up a debug Tomcat configuration). To facilitate this, Maven provides the following:

mvn eclipse:eclipse -Dwtpversion=1.5

Upon completion you’ll be able to import the project into Eclipse.

Note: If you’re mucking around and you’d like to erase the generated Eclipse project config, you can run this command:

mvn eclipse:clean

 

Have fun!

Advertisements

One thought on “Create a Dynamic Web Project in Eclipse using Maven

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s