In my previous post, we learned about creating a sample java project using maven using both modes i.e. interactive and non-interactive. In this project we will create a web application which we should be able to import on eclipse IDE.
To create eclipse supported web application, we will need to create first a normal maven we application and then we will make it compatible to eclipse IDE. Lets do it.
Step 1) Create a normal maven web application
Using below command, I am creating a web application named ‘demoWebApplication’. Archetype used is ‘maven-archetype-webapp‘.
mvn archetype:generate -DgroupId=com.howtodoinjava -DartifactId=demoWebApplication -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
This will create a web application in your workspace.
Step 2) Convert it to eclipse web application
To Convert it to eclipse web application, following command needs to be run.
mvn eclipse:eclipse -Dwtpversion=2.0
Please remember that adding “-Dwtpversion=2.0″ is necessary, otherwise using only “mvn eclipse:eclipse” will convert it to only normal java application, and you will not be able to run it as other eclipse web applications.
Step 3) Import the application in project
Click on File menu and click on Import option.