Jump to content
  • Advertisement
Sign in to follow this  
Paul65

[java] Ignoring .svn folders in Eclipse

This topic is 2434 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Basically what I need to know is how to make Eclipse ignore .svn folders when exporting to an executable .jar file.

I am using Ecliipse to export my project to an executable .jar file. I am also using SVN for source control. This means that I have lots of .svn folders scattered inside of my source code folder. When I build the .jar file it works alright, the only trouble is the .svn folders are also added to the .jar file. How do I stop this happening?

I have tried going to WIndows->Preferences->Java->Compiler->Bulding and adding .svn/ to filtered resources but no dice.

Share this post


Link to post
Share on other sites
Advertisement
I've had similar problems myself. I've never found a way to get wild card entries to work properly, I had to specify a relative path for every .svn directory to exclude.

The only reliable way I've found todo this, is by using an ANT script.
I think recent versions will exclude .svn folders by default. But to be safe try something like this:

You'll need to replace the export properties with correct path & filename.


<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<project basedir="." default="export_jar" name="Game Ant Scripts">

<!-- ============================================================================== -->
<!-- Generic Properties -->

<property name="exclude.default" value="**/.svn,**/.svn/**"/>

<!-- ============================================================================== -->
<!-- Export Properties -->

<property name="export.path" location="C:/PATH_TO_EXPORT/${ant.project.name}"/>

<property name="jar.name" value="game.jar"/>

<!-- ============================================================================== -->

<target name="export_jar" description="Export the game as a jar">

<jar destfile="${export.path}/${jar.name}" compress="true">

<zipfileset dir="bin"
includes="**/*.class"
excludes="${exclude.default}"
/>
</jar>

</target>

</project>


* Create a "Build.xml" in the root project folder.
* Replace contents with code above.
* In Eclipse: "Window -> Show View -> Ant"
* Right click, empty white space of Ant window. "Add Build files".
* Browse to the "Build.xml".
* You should see a tree view of "Game Ant Scripts -> export_jar".
* Right click "export_jar", and select "RunAs Ant".

Share this post


Link to post
Share on other sites
Have you tried installing one of the Subversion plugins for Eclipse? Maybe once Eclipse is svn aware it will automatically ignore Subversion related folders for you

Share this post


Link to post
Share on other sites
I tried the ant script and it worked, so thanks for that. Haven't tried any subversion plugins. Probably try that next.

Share this post


Link to post
Share on other sites
Without ant, add this to your .classpath file:

<classpathentry excluding="**/.svn/*" kind="src" path="src"/>

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!