Foreword: This article records the entire process of deploying and running the solr source code on the local Eclipse in the Linux environment. It has detailed descriptions for each error phenomenon encountered and the solution. If you encounter similar problems during the deployment process, welcome to communicate Discuss!
Deployment environment: linux + jdk 1.8 + Eclipse + tomcat 8.0 + solr 6.3
step:
one. jdk + Eclipse + tomcat operating environment is built. There are many online tutorials in this process, you can search by yourself. Solr6.x requires jdk1.8 and tomcat 8.0, so pay attention to the version number when installing.
two. Solr source code download and compile
Download address: http://www.apache.org/dyn/closer.cgi/lucene/solr, solr official website download address, download solr source code
solr-6.3.0-src.tgz。
Unzip the source package locally:
After decompression, enter the project. Solr is compiled with ant. Before compiling, you need to install the ant compilation environment in advance. There are tutorials on the Internet, you can find them yourself.
After the ant is installed successfully, execute the compile command, first compile it into an Eclipse project, and compile the command: ant eclipse.
After the ant is installed successfully, execute the compile command, first compile it into an Eclipse project, and compile the command: ant eclipse.
There will be a prompt after the compilation is successful
three. Import the project into Eclipse and convert it into a web project
Open Eclipse, select File → Import → Existing Projects into Workspace in the upper left corner, select the project path, and import the project into Eclipse.
After the import is complete, convert the project into a web project.
Right-click the project, select Properties, click Project Facets, select Dynamic Web Module, and change the following version to 2.5, then select java.
Click on the bottom of the Further configuration and available, change the Content directory to Webapps
Click OK, when finished, as shown in the figure
Four. file configuration
Delete the
solr-6.3.0/Webapps/
WEB-INF directory, and then copy all files in the solr-6.3.0/solr/webapp/web/ directory to solr-6.3.0/Webapps/
Create a new folder lib under solr-6.3.0/Webapps/WEB-INF, and copy
all
the files in solr-6.3.0/solr/server/lib/ext into it.
Go to
solr-6.3.0/solr and execute the command ant compile, which will generate project-dependent jar packages in the core and solrj directories.
Copy all the jar packages in the solr-6.3.0/solr/core/lib and solr-6.3.0/solr/solrj/lib directories to the
solr-6.3.0/Webapps/
WEB-INF/lib directory
Enter the
solr-6.3.0/lucene directory, execute the command
ant compile, then enter the build directory, and copy the jar package of each subproject to the
solr-6.3.0/Webapps/
WEB-INF/lib directory, because the directory More, you can use:
cp ./*/*.jar to wildcard. Enter
solr-6.3.0/lucene/build/analysis, and copy the jar packages in all subdirectories to the
solr-6.3.0/Webapps/
WEB-INF/lib directory.
Create a new folder in the solr-6.3.0 directory: solrhome, and change the file
solr-6.3.0/Webapps/WEB-INF/web.xml.
At the same time, annotate the last part of the file, otherwise the page will not be accessible due to permission problems.
Copy all files under solr-6.3.0/solr/server/solr to solrhome
Create a new directory classes under solr-6.3.0/Webapps/WEB-INF, and copy log4j.properties under solr-6.3.0/solr/server/resources into it.
So far, the configuration is basically complete.
Fives. Run and debug
Run the code in Eclipse, report errors, find ways online, and download the jdk that supports Lambda.
Later, I found that the jdk version I used at the beginning was jdk1.8.0_101, but the corresponding java version was still 1.9. Re-download jdk1.8.0_112,
re-execute the compilation instructions in solr-6.3.0/solr, and copy the jar package to the web directory. . Restart Eclipse, there is no error reported so far.
I found that there is still a problem with the page, check the background log, and an error is reported, and continue to look for a solution: