Solve ClassNotFoundExceptions with Maven war projects on Eclipse
August 31st, 2012When working on Maven web projects with Eclipse, m2e and m2e-wtp, Webapps can sometimes suddenly stop working, raising ClassNotFoundExceptions on every startup.
This is because the webapp lib folder is no longer published to the server. Cleaning, Publishing, Closing/opening project, restarting Eclipse, nothing restore this folder and its content. Additionally, a new warning appears in the problem view :
Classpath entry org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER will not be exported or published
To solve this issue, just open .classpath at the root of the project and add the following attribute to the maven classpath :
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
Save and publish to the server.
The webapp should start again.
Source: Post from Eclipse forums http://www.eclipse.org/forums/index.php/t/262101/
