title: Best way to automatically check out and compile Eclipse projects with Ant in Hudson or another CI tool?
body: <p>We have several products which have a lot of shared code and which must be maintained several versions back.</p>
  
  <p>To handle this we use a lot of Eclipse projects, some contain library jars, and some contain shared source code (in several projects to avoid getting a giant heap with numerous dependencies while being able to compile everything from scratch to ensure that source and binaries are consistent).  We manage those with projectSet.psf's as these can directly pull all projects out from CVS and leave a fully prepared workspace.  We do not do ant builds directly or use maven.</p>
  
  <p>We now want to be able to put all these projects and their various versions in a Continous Integration tool -  I like Hudson but this is just a matter of taste - which essentially means that we need to get an automatic way to check out the projects to a fresh workspace, and compile the source folders as described in the project-files in each project.  Hudson does not provide such an approach to build a project, so I have been considering what the best way to approach this would be.</p>
  
  <p>Ideas have been</p>
  
  <ul>
  <li>Find or write an ant plugin/converter that understands projectSet.psf's and map to cvs-checkout and compile tags.</li>
  <li>Create the build.xml files from within Eclipse and use those.  I tried this, and found the result to be verbose and with absolute locations which is not good with automatic tools putting files where they want to.</li>
  <li>Write a Hudson plugin which understands projectSet.psf's to derive a configuration and build it.</li>
  <li>Just bite the bullet and manually create and update the CI configuration whenever stuff breaks - I don't like this :)</li>
  </ul>
  
  <p>I'd really like to hear about other peoples experiences so I can decide how to approach this.  </p>
  
  <hr>
  
  <p>Edit: Another option might be using a CI which knows better about Eclipse projects and/or project sets.  We are not religious - this is just a matter of getting stuff running without having to do everything ourselves.  Would Cruise Control be a better option perhaps?  Others?</p>
  
  <hr>
  
  <p>Edit:  Found that ant4eclipse has a "Team Project Set" facility.  <a href="http://ant4eclipse.sourceforge.net/" rel="nofollow noreferrer">http://ant4eclipse.sourceforge.net/</a></p>
  
  <hr>
  
  <p>Edit: Used the ant4eclipse and ant-contrib ant extensions to build a complete workspace as a sjgned runnable jar file similar to the Runnable Jar facility in Eclipse 3.5M6.  I am still depending on Eclipse to create the initial empty workspace, and extract the ProjectSet, so that is the next hurdle.</p>
  
  <hr>
  
  <p>Edit:  Ended up with a dual configuration, namely that Hudson extracts the same set of modules as listed in the ProjectSet.pdf file from CVS (which needs to have the same tag) causing them to be located next to each other.   Then ant4eclipse works well with the projectSet.psf file embedded in the main module.  Caveat:  Module list in Hudson must be manually updated, and it appears that a manual workspace cleanup is needed afterwards to let Hudson "discover" that there is more projects now than earlier.  This has now worked well for us for a couple of months, but it was quite tedious to get everything working inside the ant file.</p>
  
  <hr>
  
  <p>Edit:  The "Use Team Projects" with ant4eclipse and a Ctrl-A, Ctrl-C in Project Panel with a Ctrl-V in the CVS projects in Hudson has turned out to work well enough for us to live with (for mature projects this is very rarely changed).  I am awaiting the release of ant4eclipse 1.0 - <a href="http://www.ant4eclipse.org/" rel="nofollow noreferrer">http://www.ant4eclipse.org/</a>, currently in milestone 2 - to see how much homegrown functionality can be replaced with ant4eclipse things.</p>
  
  <p>Edit:  ant4eclipse is as of 20100609 in M4 so the schedule at <a href="http://www.ant4eclipse.org/node?page=1" rel="nofollow noreferrer">http://www.ant4eclipse.org/node?page=1</a> is slipping somewhat.</p>
  
  <hr>
  
  <p>Edit:  My conclusion after using our ant4eclipse approach for a longer period is that the build script get very gnarly and is hard to maintain.  Also the Team ProjectSet facility (which ant4eclipse use to locate the projects) which works well for CVS based repositories, but not after we migrated to git (which is a big thing in itself).   New projects will most likely be based on maven, as this has good support in Jenkins.</p>