Eclipse中配置Solr源码

转自 http://hongweiyi.com/2013/03/configurate-solr-src-in-eclipse/

1. 下载solr的src包,并解压

 

2. 解压后,在解压后的根目录执行ant eclipse,即生成eclipse需要的项目文件

打开eclipse,File > Import > Existing Projects into Workspace

选择刚才解压后的根目录,这时候java build path等都已经设置好了。

 

 

3. Open Type(Ctrl+Shift+T)找到StartSolrJetty 这个类,修改main方法里面的setPort参数为默认的8983,以及ContextPath,War

War为”solr/webapp/web/”

最后的代码应该是这样的:

1Server server = new Server();
2SocketConnector connector = new SocketConnector();
3// Set some timeout options to make debugging easier.
4connector.setMaxIdleTime(1000 60 60);
5connector.setSoLingerTime(-1);
6connector.setPort(8983); // HWY: MODI
7server.setConnectors(new Connector[] { connector });
8WebAppContext bb = new WebAppContext();
9bb.setServer(server);
10bb.setContextPath("/solr"); // HWY: MODI
11bb.setWar("solr/webapp/web"); // HWY: MODI

 

4. 设置solr.solr.home,并run

在run configure中Arguments > VM arguments中写入

-Dsolr.solr.home=your/path/of/example/solr

 

我的配置为-Dsolr.solr.home=D:/Workspaces/Eclipse/lucene_trunk/solr/example/multicore

也可以在代码中修改,

System.setProperty("solr.solr.home", "your/path/of/example/solr");

使用solr自带的一个example作为sold配置的根目录,也可以设置其他的solr配置目录。点击run即可运行Solr,debug也可以用。

 

5. 浏览器输入http://localhost:8983/solr查看Solr Admin。

转载于:https://www.cnblogs.com/luanfei/p/4087972.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值