How to build Lucene / Solr from source code in windows environment in order to add patches
- by Simon
I have successfully implemented Apache’s Solr for free text searching a database driven web site build for windows platforms using Visual Studio in c#.
I am trying to get a version Solr working with field collapsing (which is not in the release version). There are patches available from apache and discussions on the web of people successfully doing this for the version I am using but my problem is cannot get the build to work.
I am a c# coder on windows platforms so java development is new to me. I understand I need to get the correct source code (and revision) from SVN, add the appropriate patches, then build the war file to deploy to my system. I cannot seem to get the source to build and produce the deployment code including jar (and subsequent war) files.
My system is:
Windows 7 Ultimate for development
Visual Studio 2010 for c# / javascript development
MyEclipse 8.6 / Eclipse 3.5 for the java build from source
Subecplise 1.6x SVN plugin to get the source from apache’s SVN
Apache Solr 1.4.1
So far I have:
Found the right patches for the function I need:
https://issues.apache.org/jira/browse/SOLR-236
Specifically I need to patch:
field_collapsing_1.1.0.patch
HTTPS //issues.apache.org/jira/secure/attachment/12357681/field_collapsing_1.1.0.patch
and
SOLR-236-1_4_1.patch
HTTPS //issues.apache.org/jira/secure/attachment/12448216/SOLR-236-1_4_1.patch
I downloaded the Lucene trunk version from the day before the patch was released (revision 958303 from 28/6/10) via subeclipse into a java package in myeclipse from:
HTTPS //svn.apache.org/repos/asf/lucene/dev/trunk
(Solr is the web implementation of Lucene and is in the subfolder solr/)
I can apply patches to the solr directory once it has downloaded but the parent Lucene project doesn’t build the war files, copy the jar or other files into the bin folder (it stays empty). The build process starts, but doesn’t do anything apart from creating the folders bin and src. I am building the whole Lucene project, which contains Solr.
I have tried building the source without patching and the same happens.
If I copy out the Solr directory into a new project, it runs the build and copies all the related files, tests, etc but fails with 4,500 errors and does not produce the jar files or war file, which I assume is because it can’t find the Lucene trunk files which it depends on.
I have two interrelated problems
1) I can't get the Lucene downloaded trunk to build
2) The jar, war and associated files are not created
Can anyone help with what I am missing to build the war file? I have spent 2 days to get this far as the help online is extremely patchy and I can’t find a walk though tutorial on building a java war file from source in a windows environment.
Any help will be much appreciated.
Simon