Windows 7 / Windows 8 - how to compile Solrj

Word Document version of this content: SolrSetup.docx (904.43 kb)

  1. [optional] Development IDE: http://www.eclipse.org/downloads/ - Java EE developers

    • Copy eclipse folder to c:\Java
    • Executed Eclipse:
  2. I already had the Java JRE installed (may have impacted steps, i.e., 6c)

  3. Java Development Kit (JDK) http://www.oracle.com/technetwork/java/javase/downloads/index.html

  4. TortoiseSVN - http://tortoisesvn.net/downloads.html

  5. Linux environment: http://cygwin.com/ - setup.exe

    • Root directory c:\Java (root when within Cygwin)
    • Package directory c:\Java\Cygwin (installation files)
    • Add “curl” and click on All icon (see arrow in figure 1), required to import xml data.
  6. Ant - http://ant.apache.org/bindownload.cgi

    • Unzip apache-ant-<ver>-bin.zip to c:\java\Ant

    • Add bin folder to path (fig 3)
    • http://www.global-webnet.net/BlogEngine/Themes/StarGazer/images/computer-head-bang.gif Note: Ant will not execute at this point! You must copy the tool.jar file from its location in the JDK to the JRE<ver>\Lib folder (fig 4)

    • Test Ant from command prompt – should get “Build.xml does not exist!” message.
  7. Compile application

    • Navigate to c:\Java\LuceneSolr folder

    • Type “ant compile” (fig 5) – there will be a number of warnings (patient may be required the first time)
    • You may need to run “ant ivy-bootstrap”
    • Navigate to the c:\Java\LuceneSolr\Solr folder

    • Type “ant dist” - you must do this from the Solr source code folder. Ant will create a “dist” folder and place the compiled .war and .jar files in it.
    • Navigate to the c:\Java\LuceneSolr\solr\dist folder and copy the apace-solr-<ver>-SNAPSHOT.war file to the c:\Java\LuceneSolr\solr\example\webapps folder (fig 6) – be sure to rename it to solr.war

  8. Start application

    • Navigate to c:\java\LuceneSolr\solr\example

    • Type “java –jar start.jar” (fig 7)
  9. Import Data

    • Launch CygWin application using Icon generated on desktop (fig 8)

    • Type “cd /” to change to root folder – you will find the contents of the Java folder if you followed my folder structure naming conventions. I find this layout makes navigation easier as you pretty much follow the same steps that you would from a command prompt.
    • Type “ls-al” to view contents of folder (optional)
    • Type “cd LuceneSolr/Solr/example/exampledocs”, note - if you do an “ls-al” here you will find all of the sample .xml files.
    • Type “./post.sh *.xml” to import all sample data into the currently running solr core. Note: if you did not install “curl” in step 5c this will not work. The “.” before the post.sh command is important, without it the environment will not find the file (unlike MS command prompt the current directory is not considered in the default path).
  10. Launch Solr

http://www.global-webnet.com/Blog/image.axd?picture=2012/4/Fig1.jpg

Figure 1 - Cygwin package selection - "curl"

http://www.global-webnet.com/Blog/image.axd?picture=2012/4/Fig2.png

Figure 2 - Source code repository

http://www.global-webnet.com/Blog/image.axd?picture=2012/4/Fig3.jpg

Figure 3 - Add Ant bin to path

http://www.global-webnet.com/Blog/image.axd?picture=2012/4/Fig4.jpg

Figure 4 - Copy tools.jar to Jre7/Lib

http://www.global-webnet.com/Blog/image.axd?picture=2012/4/Fig5.png

Figure 5 - Compile the application

http://www.global-webnet.com/Blog/image.axd?picture=2012/4/Fig6.PNG

Figure 6 - Copy compiled war file to webapps folder

http://www.global-webnet.com/Blog/image.axd?picture=2012/4/Fig7.jpg

Figure 7 - Start Solr using Jetty

http://www.global-webnet.com/Blog/image.axd?picture=2012/4/Fig8.jpg

Figure 8 - Launching CygWin

http://www.global-webnet.com/Blog/image.axd?picture=2012/4/Fig9.jpg

Figure 9 - using post.sh to import files

HowToCompileSolr (last edited 2012-07-19 09:56:12 by mr_road)