wood burning stoves
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse+Subversion: Project Directory Structure? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse+Subversion: Project Directory Structure?" Watch "Eclipse+Subversion: Project Directory Structure?" New topic

Eclipse+Subversion: Project Directory Structure?

seb petterson
Ranch Hand

Joined: Mar 04, 2005
Posts: 118

I'm trying out svn through subclipse. Curious about best practice regarding the directory setup in relation to the eclipse project.

I notice that in various tutorials, including the SVN Book, the recomendation is that you have one directory for your project, and in it, two directories "Trunk", and "Branches". Like this:

But how do you make that work in eclipse? If I create that directory structure in my eclipse workspace, eclipse does not allow me to even create a project from a directory allready in the workspace. And even if that would work, I don't think eclipse would work with a project and its coresponding directory being the root of two subdirectories holding the different branches of the project.

Should each branch be its own eclipse-project?

How should the working copies of the branches be organized on disk for it to work with the corresponding eclipse setup?

[ November 23, 2006: Message edited by: seb petterson ]
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
The job of of a version control system such as Subversion is to (somehow) contain lots of versions of your project. As well as the main thread of changes (known as the "trunk"), you can also use Subversion to take notes of "branches" (specific changes which don't apply to the main build, such as tweaks for a single customer) and "tags" (such as the version released in January).

The job of an IDE such as Eclipse is to allow you to work on one particular version of a project, make/test some changes, and update that version in the repository.

Putting all this together, the Subversion repository contains a lot more than is visible to Eclipse. What most people seem to do is as follows:

  • Create an empty Subversion file structure with three directories under the project name ("trunk", "branches", "tags").
  • Create that file structure into Subversion using the Subversion "import" command from the command line
  • Create a new "repository location" in Eclipse for your Subversion repository
  • Check out {repositoryname}/projectname/trunk as a new Eclipse project
  • add/edit files in your project, synchronize and commit as necessary etc.

  • The important point is that as far as Eclipse is concerned, the project "root" is the "trunk" directory in Subversion.

    Does that help?

    Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
    seb petterson
    Ranch Hand

    Joined: Mar 04, 2005
    Posts: 118
    Yes, thank you.

    My problem was that I started by creating the project in eclipse, and then adding it to SVN, instead of first importing a project with the Trunk-Branches-Tags sub directories, and then checking out in eclipse. Doing it in the order you suggested made it easier to combine the Trunk/Branches/Tags folder structure with the eclipse workspace project structure since it created the project folder on disk from the Trunk e.g.

    I agree. Here's the link: http://aspose.com/file-tools
    subject: Eclipse+Subversion: Project Directory Structure?
    It's not a secret anymore!