Learn to create Java web application project which we should be able to import on eclipse IDE for further development.
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 maven web application
Using below command, I am creating a web application named ‘demoWebApplication’. Archetype used is ‘
$ 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 (without web support), and you will not be able to run it as eclipse web applications.
Step 3) Import web application in Eclipse
Click on File menu and click on Import option.
Now, click on “Existing project..” in general section.
Now, browse the project root folder and click OK. Finish.
Above steps will import the project into eclipse work space. You can verify the project structure like this.
Happy Learning !!