I have a Dynamic Web Project in Eclipse. I can pack it to a WAR by right-clicking the project and choosing Export > WAR File. This creates the WAR file as expected and it works.
The problem is that Eclipse includes all the .svn folders of the project into the WAR file.
Is there a way to tell Eclipse to ignore .svn folders in the WAR exporting process? Or even better, tell it to ignore all files or folders that match some given regular expression?
Enter the project properties > Resource > Resource Filters > Add... > Exclude All > Files and Folders > All children (recursive) > Name matches *.svn > OK.
All .svn files and folders will be ignored, including when you export WAR files.
This seems to be documented in bug 182534 (2007! And still opened).
A custom separate ant script would be needed for now in order to build the exact war.
The internal "Export War" eclipse feature is not yet good enough for this scenario.
Installing the Subclipse plugin will make Eclipse aware of the SVN folders.
This also includes ignoring them in a WAR export.
You could use an svn client to do the trick. For example TortoiseSVN let you export a directory without .svn folders and files.
So what you could do is:
- Export you war
- Unzip it (a war is a zip file with changed extension)
- Tortoise-export the directory (remember to check "Include unversioned files" cause your .class will probably be unversioned)
- Zip the new directory and rename it to .war
This is not a good workaround but it saves you from checking every subfolder in your war to see if some .svn has not been removed.
While exporting the project just uncheck the unneeded folder like ".svn" in the Project Export wizard like this