How do you handle different Java IDEs and svn?

前端 未结 7 1792
天命终不由人
天命终不由人 2020-12-16 22:55

How do you ensure, that you can checkout the code into Eclipse or NetBeans and work there with it?

Edit: If you not checking in ide-related files, you have to reconf

相关标签:
7条回答
  • 2020-12-16 23:21

    Here's what i do:

    1. Only maintain in source control your ant build script and associated classpath. Classpath could either be explicit in the ant script, a property file or managed by ivy.
    2. write an ant target to generate the Eclipse .classpath file from the ant classpath
    3. Netbeans will use your build script and classpath, just configure it to do so through a free form project.

    This way you get IDE independent build scripts and happy developers :)

    There's a blog on netbeans site on how to do 3. but i can't find it right now. I've put some notes on how to do the above on my site - link text (quick and ugly though, sorry)

    Note that if you're using Ivy (a good idea) and eclipse you might be tempted to use the eclipse ivy plugin. I've used it and found it to be horribly buggy and unreliable. Better to use 2. above.

    0 讨论(0)
  • 2020-12-16 23:22

    The best thing is probably to not commit any IDE related file (such as Eclipse's .project), that way everyone can checkout the project and do his thing as he wants.

    That being said, I guess most IDEs have their own config file scheme, so maybe you can commit it all without having any conflict, but it feels messy imo.

    0 讨论(0)
  • 2020-12-16 23:23

    We actually maintain a Netbeans and an Eclipse project for our code in SVN right now with no troubles at all. The Netbeans files don't step on the Eclipse files. We have our projects structured like this:

    sample-project   
    + bin
    + launches  
    + lib  
    + logs
    + nbproject  
    + src  
      + java
    .classpath
    .project
    build.xml
    

    The biggest points seem to be:

    • Prohibit any absolute paths in the project files for either IDE.
    • Set the project files to output the class files to the same directory.
    • svn:ignore the private directory in the .nbproject directory.
    • svn:ignore the directory used for class file output from the IDEs and any other runtime generated directories like the logs directory above.
    • Have people using both consistently so that differences get resolved quickly.
    • Also maintain a build system independent of the IDEs such as cruisecontrol.
    • Use UTF-8 and correct any encoding issues immediately.

    We are developing on Fedora 9 32-bit and 64-bit, Vista, and WindowsXP and about half of the developers use one IDE or the other. A few use both and switch back and forth regularly.

    0 讨论(0)
  • 2020-12-16 23:27

    I use maven, and check in just the pom & source.
    After checking out a project, I run mvn eclipse:eclipse
    I tell svn to ignore the generated .project, etc.

    0 讨论(0)
  • 2020-12-16 23:37

    For the most part I'd agree with seldaek, but I'm also inclined to say that you should at least give a file that says what the dependencies are, what Java version to use to compile, etc, and anything extra that a NetBeans/Eclipse developer might need to compile in their IDE.

    We currently only use Eclipse and so we commit all the Eclipse .classpath .project files to svn which I think is the better solution because then everyone is able too reproduce errors and what-not easily instead of faffing about with IDE specifics.

    0 讨论(0)
  • 2020-12-16 23:41

    I'm of the philosophy that the build should be done with a "lowest common denominator" approach. What goes into source control is what is required to do the build. While I develop exclusively in with Eclipse, my build is with ant at the command line.

    With respect to source control, I only check in files that are essential to the build from the command line. No Eclipse files. When I setup a new development machine (seems like twice a year), it takes a little effort to get Eclipse to import the project from an ant build file but nothing scary. (In theory, this should work the same for other IDEs, no? Surly they must be able to import from ant?)

    I've also documented how to setup a bare minimum build environment.

    0 讨论(0)
提交回复
热议问题