What to Do With IDE Project Files

August 18, 2011

Each IDE generates its specific project/config/build files. Eclipse generates .project and .classpath, and also the .settings directory. IntelliJ IDEA has its .iml files. And it is always a question what to do with these files in terms of source control management (SVN, CVS, git, etc)

The generally accepted practice is to add them to the SCM ignore list (svn:ignore for example). Why?

  • the project does not become aware of the IDE it is developed in. Each team member can use an IDE of their choice
  • there is no danger of sneaking absolute path configurations into the repository
  • no developer can override the local settings of other developers

This practice makes sense, but it has one major drawback – the complexity of setting up a project has to be repeated every time. In other words, you can’t start developing immediately after you checkout – you have to configure tons of things – deployment on local server, checkstyle configurations, plugin configurations, etc. Joel Spolsky insists on having a one-step build. Using a build tool instead of the IDE build process is preferable (ant, maven). But in addition to that you should also have a one-step development environment setup (apart from installing a database/search engine/etc.).

So how to do that? I know this is an unpopular advice but: commit the IDE project files in the repository. Once a member has a successful local setup, the files should be committed so that everyone else can just checkout/update, and get the project running. I’m sure everyone has gone through the trouble of helping set up the project for new team members, or when getting a fresh checkout on the local machine (due to scm bugs, OS reinstall, whatever).

Of course, you can’t just commit everything – look at the list above to see the reasons why this may be wrong. Here’s one thing to remember: never commit absolute paths. Everything must be project relative. If for some reason (for example – deployment with FileSync rather than WTP, in Eclipse) you need an external path – place it in a variable withing eclipse and use that.

As for the other two bullets from the above list – having the project files committed does not tie to project to a specific IDE. It makes it available for immediate use for that IDE. There is no problem in having .project and .iml files in the same project. It’s just that they won’t be used by everybody. But no part of the project is used by everybody anyway. About local preferences – don’t commit those. Determine what IDE files are needed for getting the project running and ignore the rest. For example, and eclipse WTP project will need the faceted project settings committed – that is “.settings/….facet.core.xml”. Having consistent formatting rules requires a .prefs file. But view settings for a BPM visualization plugin are a matter of developer preference – ignore them.

Finally, have one .txt files in the project root that describes in a few lines how to have a working environment. The aforementioned IDE variables (if needed), the required IDE plugins, installing the needed software (e.g. database), etc. But it should be minimal – after all we are trying to have an (almost) one-step development environment setup.

Update: Many people suggested that maven solves all these issues. It doesn’t. The Eclipse-maven integration, for example, is almost good enough, but not quite. You still have to perform some manual tasks. m2eclipse doesn’t allow you to deploy. m2eclipse-wtp does, but it doesn’t always work, sadly. Enabling project facets is not something maven does. And there are more. Maven is a huge improvement, but it is not enough in many cases.

If you find the content interesting, you can subscribe and get updates


 

7 Responses to “What to Do With IDE Project Files”

  1. Amem, brother ! I agree 100% . In our team, we’ve switched from forbidding Eclipse files in SCM to committing them as the very first step in development.

    Currently, we are developping our own application stack; it’s a Perl script that quickly generates an Eclipse project with GWT, Spring and JPA support. Kind of what the Eclipse plugin for GWT does, but a few steps further. Think Spring Roo. The generated application is already born with a GWT frontend, and connecting to a database.

    In order to achieve this, we had a thorough look at how Eclipse configuration files work, and how to generate an Eclipse file with what we expected for our project.

    We also enforced the policy that since Eclipse settings are development artifacts, we are required to look very closely at them before we commit them, and look at the diffs, like we do for Java files. it’s easier because those are text files. You don’t need to understand the structure of Eclipse files, but you should raise an eyebrow if you see an absolute path in a file you are about to check in.

    In order to achieve this,

  2. We are using maven as build tool and m2 plugin in eclipse. After the checkout we are importing the maven project into eclipse and that’s it. Eclipse can handle all dependencies from the pom.xml and no additional config file necessary in the repo.

    Fortunatelly the Indigo version already contains the maven plugin.

    Regards,
    Lex

  3. You can build the project, but can you run it in locally?

  4. Beside the already mentionned m2e there’s a simple trick in SVN to separate IDE-specific files and your project using svn:external.

    So you repository layout looks like this:

    + myproject
    + trunk
    + sources
    + src
    pom.xml
    + ide
    + eclipse
    .project
    .classpath
    svn:external …/myproject/trunk/sources/src src
    + netbeans
    ….
    + intellij
    ….

  5. Reverse Phone Check is our top pick having a 99.7Percent recovery rate.
    Reverse Phone Check was able to successfully pass much more in our considerable examinations than every other reverse
    phone look up assistance. Reverse Phone Check supplied us because of
    the information and facts we desired, for any style of range they claimed.

    Feel free to visit my webpage … reverse phone lookup verizone (loucogame.com)

  6. I don’t even understand how I finished up here, but I thought this put up used to be good.

    I do not recognise who you might be but certainly
    you are going to a well-known blogger for those who are not already.
    Cheers!

    Feel free to surf to my homepage … web page (Scarlett)

  7. With this, a special laser is used instead of a blade to create the flap.

    And that’s why younger persons can’t undergo laser eye
    surgeries. In the Feds crackdown, these five LASIK providers across the country got FDA warning letters:.

    Also visit my website … eye laser london (http://www.youtube.com)

Leave a Reply