How-to-setup-OpenGrok

安装OpenGrok用于阅读代码

参考:

https://gitee.com/opennlp/opengrok/wikis/How-to-setup-OpenGrok?sort_id=2039238

https://github.com/oracle/opengrok/wiki/How-to-setup-OpenGrok

Requirements:

    JDK 1.8 or higher

    OpenGrok '''binaries''' from https://github.com/OpenGrok/OpenGrok/releases (.tar.gz file with binaries, not the source code tarball !)

    https://github.com/universal-ctags for analysis (avoid Exuberant ctags, they are not maintained anymore)

    A servlet container Tomcat 8.0 or later also running with Java at least 1.8

Downloading the distribution tar ball and setting up directory structure

    mkdir D:\opengrok

    cd D:\opengrok

    mkdir src data dist etc log

    将opengrok-X.Y.Z.tar.gz解压到D:\opengrok\dist

    将D:\opengrok\dist\doc\logging.properties拷贝到D:\opengrok\etc

    并修改如下:

java.util.logging.FileHandler.pattern = D:\\opengrok\\log\\opengrok%g.%u.log

java.util.logging.FileHandler.append = false

java.util.logging.FileHandler.limit = 0

java.util.logging.FileHandler.count = 30

java.util.logging.FileHandler.level = ALL

Creating the index

需要理解:


Step.1 - Setting up the sources / input data

    将代码拷贝到D:\opengrok\src

Step.2 - Deploy the web application

    将D:\opengrok\dist\lib\source.war拷贝到D:\apache-tomcat-9.0.33\webapps

    tomcat需要设置环境变量

    JAVA_HOME=D:\ProgramData\Java\jdk1.8.0_241

    CATALINA_HOME=D:\apache-tomcat-9.0.33

    运行tomcat

    %CATALINA_HOME%\bin\catalina.bat start

    修改:D:\apache-tomcat-9.0.33\webapps\source\WEB-INF\web.xml,CONFIGURATION修改如下

Full path to the configuration file where OpenGrok can read its configuration

CONFIGURATION

D:\opengrok\etc\configuration.xml

 Step.3 - Indexing

java -Djava.util.logging.config.file="D:\opengrok\etc\logging.properties" -jar "D:\opengrok\dist\lib\opengrok.jar" -c "D:\ctags-2020-03-23_cab58b54-x64.debug\ctags.exe" -s "D:\opengrok\src" -d "D:\opengrok\data" -H -P -S -G -W "D:\opengrok\etc\configuration.xml" -U http://localhost:8080/source

你可能感兴趣的:(How-to-setup-OpenGrok)