Transfer from http://hongweiyi.com/2013/03/configurate-solr-src-in-eclipse/
1. Download SOLR's SRC package and unzip
2. after extracting, execute ant eclipse in the extracted root directory, that is, build the project file required by eclipse
Open Eclipse,file > Import > Existing Projects into Workspace
Select the root directory you just unzipped, and the Java build path has been set.
3. Open Type (ctrl+shift+t) Find Startsolrjetty This class, modify the Setport parameter inside the main method is the default 8983, and Contextpath,war
The war is "solr/webapp/web/"
The final code should look like this:
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(); |
10 |
bb.setContextPath( "/solr" ); // HWY: MODI |
11 |
bb.setWar( "solr/webapp/web" ); // HWY: MODI |
4. set Solr.solr.home, and run
Write in Arguments > VM arguments in Run configure
-dsolr.solr.home=your/path/of/example/solr
can also be modified in the code,
System.setproperty ("Solr.solr.home", "YOUR/PATH/OF/EXAMPLE/SOLR");
Use a example that comes with SOLR as the root of the sold configuration, or you can set up additional SOLR configuration directories. You can also run Solr,debug by clicking Run.
5. Browser input HTTP://LOCALHOST:8983/SOLR view SOLR Admin.
Configuring SOLR Source in Eclipse