lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Solr Wiki] Update of "HowToContribute" by ErickErickson
Date Sun, 18 Apr 2010 01:51:38 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "HowToContribute" page has been changed by ErickErickson.


  <!> [[Solr1.3]] If you are using eclipse to follow trunk (leading up to the 1.3 release)
eclipse will give several errors about not resolving components in the solrj library. This
will appear in the org.apache.solr.handler.component package relating to distributed search
( ...etc) The solution is to compile the solrj library via the dist-solrj
target and add them to your eclipse build path. After running the dist-solrj target look in
dist/solrj-lib and add apache-solr-solrj-1.3-dev.jar and commons-httpclient-3.1.jar to your
- DevelopmentEnvironmentTips
+ = DevelopmentEnvironmentTips =
+ There was a recent thread concerning trying to set up Lucene and SOLR in Eclipse. Here is
a guide for setting up Eclipse and IntelliJ dev environments:
+ Follow the instructions above to fetch the combined Lucene and SOLR trunk. For the remainder
of this document, the installation path is assumed to be ~/apache/trunk/lucene and ~/apache/trunk/solr.
NOTE: I'm installing on a Macbook, so this is a *nix style file system etc. These instructions
should work for windows as well, but if you try to use them in that environment, feel free
to update this page with anything you uncover.
+ Before fiddling with the IDE, I'd strongly recommend you get the tests to run from the shell.
This will insure that your machine has the proper setup for the IDEs to magically find what's
necessary. See the instructions above. Hint: Issue 'ant clean test' in the SOLR and Lucene
directories and look for "BUILD SUCCESSFUL" minutes later.
+ Setting things up is actually very smooth when it's smooth, especially if the tests have
run <G>.
+ == Eclipse (Galileo, J2EE version, but any relatively recent Eclipse
should do): ==
+ This is easy since Paulo Castagna did the hard work and then posted two files you'll need,
.classpath and .project for both Lucene and SOLR. Note: These are *not* currently checked
in to SVN, they are attached to this page. You might find yourself asking the question "where
did these files unzip to?" Since they start with a dot (.), the OS X Finder doesn't show them
by default. You can do an "ls -a" in a terminal window and they'll show up. Something similar
may occur in Windows.
+ Put the respective .classpath and .profile files in ~/apache/trunk/lucene and ~/apache/trunk/solr.
Now fire up Eclipse and just select "File>>New>>Java Project". Click "Create project
from existing sources". Browse to ~/apache/trunk/lucene (this should be whats in the "directory"
textbox). Now just click through to "finish", accepting the defaults. Eclipse will chew away
on this for a while.
+ Now you should be able to navigate into your project. ctrl-click (or right click) on one
of the test case, select "Run as>>Junit test" and things should "just work". If not,
let's chat and update this page.
+ Do the same thing to create a new Java project for ~/apache/trunk/solr.
+ DO NOT BE SURPRISED IF SOME TESTS FAIL IN THE IDE. There are some anomalies when running
Junit tests for these projects in an IDE. Some of them are already cleaned up, but others
may still fail when run in an IDE. The definitive case for whether a test fails or not is
running it as an Ant task.
+ === Installing the code style file ===
+ Lucene and SOLR have a common code style preferences. Install one in your Eclipse and set
it as the default for the project. Do this by:
+  *Getting the Eclipse code style xml files (see this page).
+  *In Eclipse, click "Project>>Properties". In the dialog box, click "Java code style>>Formatter".
Up in the upper right of the dialog box that comes, click "Configure Workspace Settings".
NOTE: you can do this on an individual project basis if you prefer.
+ You should now be able to click the "import" button, and import the codestyle file you downloaded.
Eclipse doesn't immediately show that the selected import is the new code style, but closing
the dialog boxes and coming back to the formatter page should allow you to choose it.
+ Tips:
+  *Under some conditions, I've seen this process have thousands of compile errors, something
like "class XXX defined in multiple places". This went away when I highlighted the project
and clicked "refresh".
+  *Think about installing the subclipse plugin, it'll allow you to update your source from
within Eclipse. See:
+  *You can create patches for the committers to apply from within the IDE easily.
+  *By and large, you won't "run" a Lucene program, you'll really run unit tests. (Others,
please chime in here!!!). The general development cycle for Lucene is to add functionality,
add unit tests, make sure all unit tests run and check in (actually, submit a patch to check
in, preferably attached to a JIRA issue). There's no "program" that you start up in your IDE
to test changes, just use unit tests.
+ Running SOLR in Eclipse: 
+ See:
+ == IntelliJ (Maia-IU-95.24) ==
+ In a word, cheat. Follow the instructions above to get the source code AND copy the Eclipse
.project and .classpath files to the Lucene and SOLR directories. Yes, the Eclipse ones. But
you do NOT need to open Eclipse or make any Eclipse projects, just have the .project and .classpath
files in the right place.
+ Fire up IntelliJ and click "create new project>>import project from external model
(Eclipse)" and click some "next" buttons until the new projects dialog appears. In the "Select
Eclipse directory" textbox, navigate to ~/apache/trunk/lucene". I just let the defaults stay
"Create module near .classpath files" Project File Format is ".idea (directory based). Now
click through until you get to a "finish" button and wait a bit.
+ You should now be able to run tests by finding a test file, crtl-click (right click) on
a test file and "run". IntelliJ seems to figure out that it's a junit test.
+ Note: I'm having some trouble executing some of the tests, for instance TestPorterStemFilter
can't find This file exists as a sibling to the test file, I won't have
time to try to figure out why for a couple of days. I'm almost entirely sure I need to set
some path in IntelliJ, anyone want to jump in here and figure it out for me?
+ Then I did the same thing for SOLR, *except* I created a new "module" rather than "project".
The first JUnit test I ran worked perfectly.
+ IntelliJ seems to have Subversion support built-in, no real need to install a plugin.
+ I haven't tried to set up SOLR to run from within IntelliJ yet, if anyone has feel free
to add the instructions.
+ === Installing code style ===
+ To install the Lucene/SOLR codestyle files, get the IntelliJ codestyle file from this site
and put it in the magic place so IntelliJ can find it. On my Mac that is in ~/Library/Preferences/IntelliJ90/codestyles
and restart IntelliJ.
+ Now click on the "Settings" icon (the little in the toolbar) and click "codestyle". You
should see the new code style configuration in the select box. NOTE: the name in the select
box is the name from the <code_scheme....> tag in the xml file. It is NOT the name you
put on the file, which can be a bit confusing..
+ IntelliJ also allows you to create patches very easily...
+ === One final note ===
+ As always, there are gremlins out there. This guide works for me on my machine for both
Eclipse and IntelliJ. However, this isn't the first project I've put in either of those environments
here. Your machine with your history may have different results. If there are steps you have
to take, please either let me know or update this page directly so others can benefit.

View raw message