Ignore SVN files when exporting a WAR file from Ec

2019-01-19 12:15发布

问题:

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?

回答1:

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.



回答2:

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.



回答3:

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



回答4:

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.



回答5:

While exporting the project just uncheck the unneeded folder like ".svn" in the Project Export wizard like this



标签: eclipse svn war