By default, a ‘Dynamic Web Application’ project in Eclipse will put the non-code resources (pages, WEB-INF, META-INF, etc.) in a folder under the project called WebContent.
Exporting .war files or publishing to a server works just fine, as Eclipse knows what WebContent represents, and what should be done in order to deploy it.
The trouble comes when you want to create a new WebContent folder (which you might want to do if you’re going to start using Maven as a build tool on an existing project – Eclipse no longer knows where the resources are and your exports stop working.
If you end up in this situation, you can fix it if you know where in the Eclipse config the declaration of WebContent is. Problematic if you deleted the old WebContent folder already as the declaration gets tidied up (by my experience anyway).
The fix is very simple. Say you want to declare /src/main/webapp as your new WebContent folder
1. Open the .settings folder under the project (if you can’t see it in the Project Explorer view, use the Navigator view)
2. Open the file org.eclipse.wst.common.component
3. In the wb-module tag, add a new entry as follows:
Here’s an example of a basic file to put that into context.
I believe you can (and should) do this through the GUI –
Your Project > Properties > Deployment Assembly
And to have say ‘WebContent’ in your project root folder and thus avoiding the navigation through all the directories just to open your jsp/jsf files is easy too.
New > Folder, name ‘WebContent’ (or whatever) & add an alias to the directory.