How to debug solr souce code in your IDEA
Gabriel Zhang June 3, 2014
If you are puzzled by some behavior Solr was showing you, I think you should to debug your issues in Solr source code. It's very easy to debug Solr source code in your IDEA, just following these steps:
For the default, there is no solr.war
in your solr-4.7.0/solr/example/webapps
, so you need to generate it firstly.
So you need run the following command in your solr folder solr-4.7.0/solr
:
After this command, it will generate the war file in solr-4.7.0/solr/dist
, so move it to solr-4.7.0/solr/example/webapps
.
Then step into solr-4.7.0/solr/example
, and start this Solr server with debug mode:
After this command, you can access Solr admin page http://localhost:8983/solr/
The final thing is we need to configure IDEA, you need to open Remote configuration page, Run->Edit Configurations
, and then click +
button, choose Remote configuration page, and configure it as following figure:
click the debug button in the toolbar, And then you can set any breakpoint in your IDEA, and then debug your code:
If you want to know how to run solr source code in your IDEA, you can refer to blog How to Run Solr Source Code in Your IDEA.
And now, please enjoy it! Have fun hacking on Solr!