How to run solr source code in your IDEA
Gabriel Zhang June 2, 2014
You need to do is to download the source code of solr, choose the version you want to use in Apache Solr Archieve. For myself, I choose the Solr-4.7.0:
Download and install Apache Ant:
And set path environment for Apache Ant:
For the default, Apache Ant doesn't include Apache Ivy, so we need to install it firstly. There are two ways to install Apache Ivy, the first way is use command ant ivy-bootstrap
, another way is to download ivy-xxx.jar
, and put it in the lib folder of Apache Ant.
If you don't install Apache Ivy firstly, you will encounter this problem:
Generate IDE project configurations, If you want to use Eclipse project, you can use command ant eclipse
, if you want to use IDEA project, you can use command ant idea
, if you want to use Netbeans project, you can use command ant netbeans
.
Then we run this command:
After soooo long time(Ivy will download all the dependencies at the first time), we will get the successful message:
Then we can use IDEA to import solr source code project.
Find class org.apache.solr.client.solrj.StartSolrJetty
, it in the package solr/solrj/src/test
. Then we need to set solr home firstly:
and change the war path:
At last, run StartSolrJetty
, and then you can visit the Solr Admin Page directly.
More information you can learn from Solr wiki, How To Compile Solr