How to create a eclipse web application using maven
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.
Latest posts by Lokesh Gupta (see all)
- [SOLVED] Bean property ‘configurationClass’ is not writable or has an invalid setter method – 8 December, 2013
- [SOLVED] java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider – 8 December, 2013
- [SOLVED] java.lang.NoClassDefFoundError: org/hibernate/engine/SessionFactoryImplementor – 8 December, 2013
- Spring 3.2.5.RELEASE and Hibernate 4 Integration Example Tutorial – 8 December, 2013
- Managing Users from Console in MySQL Database – 29 November, 2013