Convert a Maven Java Project to a Web Project

IDE: Eclipse Juno

Step 1:  Add Dynamic Web Module

right click project -> properties -> project facets -> tick ‘Dynamic Web Module’ -> Click ‘Further configuration available’ -> Set Content directory to ‘src/main/webapp’ -> OK -> OK

Step 2:  Add Web Module to Source

right click project -> properties -> Java Build Path -> Source -> Add Folder -> tick ‘src/main/webapp’ -> OK -> OK

Step 3:  Add Deployment Assembly

right click project -> properties ->Deployment Assembly -> Add -> Java Build Path Entries -> Maven Dependencies -> Finish ->OK

If your project depends on another local project, you should be extremely carefully here, 

An internal error occurred during: "Updating status for Tomcat v7.0 Server at localhost...".
java.lang.NullPointerException
If you encountered this problem, the solution is to depend on a jar from Maven server, DO NOT depend on a local project, otherwise maven may not know how to copy it to WEBINF/lib.

Reference 1: http://newspringwork.iteye.com/blog/1727480

你可能感兴趣的:(Convert a Maven Java Project to a Web Project)