I have an Eclipse web project that was working perfectly fine until I converted it to a Maven project. Previously, I could make changes to a servlet, restart Tomcat from the Eclipse Servers tab, and then browse to my localhost to view the page. Any changes I made to a JSP file were reflected immediately on page reload.
After converting to a Maven project, when I make a change to a Java file, the .class file under the build directory is not updated, even though I have Build Automatically selected. If I delete the .class file, it does not get rebuilt. If I try to view the webapp in a browser, I see a ClassNotFoundException for the servlet class.
I have spent a lot of time going through the project’s properties and searching online, but I can’t figure out how to get this working again. Any help is appreciated.
UPDATE: I fixed part of the problem by moving my source files from project_root/src to src/main/java. Now I can build the project using Maven, but I still have to manually copy the class files to my local tomcat’s webapp directory. If anyone knows of a way to automate this, I would like to hear it. Thank you.
I solved this by moving my source files from project_root/src to src/main/java and then making sure that src/main/java was on the build path under Project > Properties > Java Build Path > Source tab. Eclipse now deploys my changed files to the proper directory under .metadata so the changes show up in my local instance of Tomcat. @davidfmatheson, thanks for your comments, I will look into using m2e-wtp.