Sign in to follow this  

[java] Ignoring .svn folders in Eclipse

This topic is 2246 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
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.

[code]
<?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>
[/code]

* 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

This topic is 2246 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this