eclipse调试solr

来源:互联网 发布:php 秒杀系统设计思路 编辑:程序博客网 时间:2024/06/06 13:16

1、下载solr源码,src包或svn(我这里的版本的是4.4)

2、使用ant编译,ant需要将 ivy-xxxx.jar 复制到 %ANT_HOME%\lib。然后ant eclipse。

3、这时就可以将solr源码导到eclipse中。

4、找到StartSolrJetty类,该类可以在本机以Main的方式启动一个Solr服务。

5、修改StartSolrJetty,结果像下面这样:

    Server server = new Server();    SocketConnector connector = new SocketConnector();    // Set some timeout options to make debugging easier.    connector.setMaxIdleTime(1000 * 60 * 60);    connector.setSoLingerTime(-1);    connector.setPort(8983);    server.setConnectors(new Connector[] { connector });        WebAppContext bb = new WebAppContext();    bb.setServer(server);    bb.setContextPath("/solr");    bb.setWar("solr/webapp/web");//源码中这个是webapp/web
6、然后设置solr home。即在run/debug configure中Arguments > VM arguments中写入-Dsolr.solr.home=solr的安装路径/solr/example/solr 
这样StartSolrJetty进行Debug后就可以调试了。