How to convert maven project to web application project?

Satya Rao picture Satya Rao · Apr 19, 2013 · Viewed 7.5k times · Source

I want to convert a maven project to a web application project, which should contain web.xml. I am using eclipse juno 4.2 with m2e (maven integration for eclipse) plugin software.

Any reply would be appreciated.

Answer

Fred Bricon picture Fred Bricon · Apr 19, 2013
  • Install m2e-wtp
  • In your pom.xml, change or add the war packaging
  • right-click on project > Maven > Update project
  • m2e-wtp will create the src/main/webapp folder and add the Dynamic Web project Facet¤
  • manually add a WEB-INF folder under src/main/webapp
  • right-click on project > Java EE Tools > Generate Deployment Descriptor stub It will create a web.xml under src/main/webapp/WEB-INF/

¤ By default, the web facet is set to 2.5. You should update it, if needed, under project properties > Project Facets BEFORE generating the web.xml