Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore SVN files when exporting a WAR file from Eclipse?

Tags:

eclipse

svn

war

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?

like image 656
Andrés Mejía Avatar asked Aug 18 '09 16:08

Andrés Mejía


4 Answers

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.

like image 71
Talles Avatar answered Oct 31 '22 18:10

Talles


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.

like image 26
VonC Avatar answered Oct 31 '22 18:10

VonC


Installing the Subclipse plugin will make Eclipse aware of the SVN folders. This also includes ignoring them in a WAR export.

like image 2
user342394 Avatar answered Oct 31 '22 18:10

user342394


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:

  1. Export you war
  2. Unzip it (a war is a zip file with changed extension)
  3. Tortoise-export the directory (remember to check "Include unversioned files" cause your .class will probably be unversioned)
  4. 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.

like image 1
user674633 Avatar answered Oct 31 '22 17:10

user674633