Eclipse (Galileo, J2EE version 1.2.2.20100217-2310, but any relatively recent Eclipse should do):

Checkout the trunk with subclipse (location: https://svn.apache.org/repos/asf/lucene/dev/trunk), then run 'ant eclipse' and refresh your project.

If you don't have a project yet to refresh, click File>>New>>Java Project. Uncheck "use default location", and navigate to "solr home" and just open that. It'll churn for a while, but it'll get there in the end. At that point you should be able to right-click on one of the test cases and run a Junit test, but see the "-ea" notes below.

Remote debugging

First, start up your server (here I'm using the default Jetty server) and start it with these options:

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7666 -jar start.jar

"address" is the port you're going to attach to, the port you use is arbitrary. Now, in Eclipse hit the little down arrow next to the cute little bug icon and then "debug configurations>>remote java applications" and click the "new" icon in the upper left. Name your project and put the port in that corresponds to the "address" above.

You should now be able to set breakpoints etc. when you run this configuration.

Enabling Assertions for unit tests in Eclipse

By default, Eclipse does not run test with assertions enabled. This causes some tests to run incorrectly in Eclipse and excludes some checks in the source code.

Change this by checking the box "Add '-ea' to VM arguments when creating a new JUnit launch configuration".

This checkbox is available under Windows>Preferences>Java>JUnit

Eclipse (using Git)

Work has begun to maintain a Git repository with project settings. It allows a simple "File -> Import... -> Projects from Git" workflow using EGit (version >= 0.9). Currently it's a single Eclipse project compiling Lucene and Solr without errors. It's likely better to have separate projects for proper dependency management. Please contribute!

The repository is available on GitHub (git://github.com/eclipseguru/lucene-solr.git). It can be easily kept in sync with Apache SVN using the Lucene & Solr Git mirror.

Tips

Running SOLR in Eclipse, Solr-1.4 Sept. 2009, see: http://searchhub.org/2009/09/02/setting-up-apache-solr-in-eclipse/.