Eclipse中配置Solr源碼

來源:互聯網
上載者:User

標籤:style   http   io   ar   os   使用   java   sp   strong   

轉自 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/”

最後的代碼應該是這樣的:

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

 

4. 設定solr.solr.home,並run

在run configure中Arguments > VM arguments中寫入

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

也可以在代碼中修改,

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

使用solr內建的一個example作為sold配置的根目錄,也可以設定其他的solr配置目錄。點擊run即可運行Solr,debug也可以用。

 

5. 瀏覽器輸入http://localhost:8983/solr查看Solr Admin。

Eclipse中配置Solr源碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.