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.
The comment on this change is: Expanded IntelliJ setup notes.
http://wiki.apache.org/solr/HowToContribute?action=diff&rev1=44&rev2=45

--------------------------------------------------

  See: 
http://www.lucidimagination.com/developers/articles/setting-up-apache-solr-in-eclipse.
  
  == IntelliJ (Maia-IU-95.24) ==
+ === Cheap, easy way to get basic functionality running ===
  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 porterTestData.zip. 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?
+ Note: Out of the box, testPorterStemFilter fails with the error "cannot find 
porterTestData.zip". Apparently, the test that calls for this file is looking 
for org/apache/lucne/analysis/porterTestData.zip and can't find it. You can 
solve this (and, I assume related issues) by specifying a "library" and 
clicking the "attach jar directories", then point it at 
~/apache/trunk/lucene/src/test". Now make your module rely on the new library. 
  
  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.
  
@@ -253, +254 @@

  
  I haven't tried to set up SOLR to run from within IntelliJ yet, if anyone has 
feel free to add the instructions.
  
+ === More flexible setup without using Eclipse .project files ===
+ 
+ This turns out not to be too bad, but tedious. Cheating by using the Eclipse 
files kinda works, but then you're stuck with all of the contrib packages, etc. 
Here's a general outline. I'll expand it if the dev list (which I (Erick 
Erickson) monitor) shows that there's enough interest... 
+ 
+ Instead of an "all at once" setup, I created a series of modules, for 
instance "lucene", "lucene_test" etc. You can group them any way you want 
(IntelliJ has a "Move Module to Group" option). So my structure looks like this:
+ 
+ {{{
+  Lucene
+  Lucene_test
+  contrib (group)
+    highlight
+    memory
+    queryparser
+ }}}
+ 
+ After you've gotten the source code, you can set up various modules and 
create groups, moving things around by the context-menu choices. By and large, 
the trick is to then make each module dependent on other modules as needed, as 
well as on the main Lucene library in ~/apache/trunk/lucene/lib that contains 
the jars for junit, ant, etc.
+ 
+ So, first "create new module from existing source" for, say, Lucene. In this 
setup, I created it from the source at ~/apache/trunk/lucene/src/java This 
gives the starter kit. Then I created the "Lucene_Test" module, but now you 
have no choice to "create from source", instead you just choose "create module 
from scratch", but then navigate to the source at 
~/apache/trunk/lucene/src/test. Set up a library to point to 
~/apache/trunk/lucene/lib. Make both the modules depend on this library, and 
additionally make the Lucene_Test module depend on the Lucene module (see the 
"module settings>>dependencies" tab). You should now be able to get the test 
cases to run. See the note above about how to find resources, e.g. 
"porterTestData.zip". I haven't run all the tests from inside IntelliJ yet, but 
this should start things rolling.
+ 
+ That's about it for Lucene itself, but for the contrib modules it's almost as 
straight-forward. Go through the same "create module from scratch" and 
optionally move the new module to a group or sub-group. You can create a new 
module from the source at, say, ~/apache/trunk/lucene/contrib/queryparser. 
Resolve as above by making this module dependent upon other modules (in this 
case, Lucene and Lucene_test), and the "project library" at 
~/apache/trunk/lucene/lib (note, you should have created this when you 
initially set up the original Lucene and Lucene_test modules).
+ 
+ NOTE: some contrib modules depend upon other contrib modules, so you may have 
to create several contrib modules to resolve all of these. Highlighter is a 
case in point.
+ 
+ Test should now run for the contrib module. One quirk I'm seeing is that 
bringing up the context menu for a contrib test directory wants to run the 
Lucene_Test tests. But going one level down and bringing up the context menu 
for, say, org.apache.lucene.queryParser runs the tests in that module.
+ 
+ As usual, the first time one does all this it's mysterious and often requires 
several false starts, but pretty soon it takes "just a few clicks of the mouse".
  
  === 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.

Reply via email to