Eclipse is deleting my lib folder from a Tomcat deployment when the application is closed, reopened and Tomcat is started again

I have a problem in Eclipse Luna with the Gradle STS tooling installed. I also have Tomcat setup as a local server, and a web application built with Gradle.

I have added the web application to the Tomcat server and run it successfully.

I then close and reopen Eclipse. When I start the Tomcat server again, the lib folder is being deleted from C:\Dev.metadata.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\my-app-name\WEB-INF (C:\Dev is the location of my Eclipse workspace). I can literally watch the lib folder disappear when I start Tomcat after opening Eclipse.

I can reproduce this problem quite reliably. Fixing the issue is as simple as stopping Tomcat, cleaning the Eclipse project, cleaning Tomcat and starting Tomcat again. But when I close and reopen Eclipse, the lib folder is deleted again.

Has anyone else experienced this, and is there an easier fix than constant project and Tomcat cleaning?

This may have been because our projects did not specify a src folder. We don’t include any Java source code in our web apps, so there was no folder defined in the build.gradle script (and obviously we didn’t have the default folders in place either).

Adding the following code to the build.gradle file

sourceSets {

main {

java {

srcDir ‘src’

}

} }

appears to have solved the issue.