原文:http://blog.163.com/huang_xin163/blog/static/175156597201112672535335/
1、安装 Java EE 6 SDK,附带了GlassFish
2、打开OpenGrok目录,将opengrok.jar,source.war 和 run.bat 拷贝出来放到c:\OpenGrok目录下
3、下载 ctags并解压到OpenGrok目录
4、下载Astyle,并将Astyle.exe复制到OpenGrok目录
5、新建两个文件夹 data, source
现在C:\OpenGrok 看起来应该是这样
6、修改run.bat,用你的源码目录替换 proj+data
+source
+ctags
astyle.exe
opengrok.jar
source.war
run.bat
REM Get the name of the directory this run.bat script is living in.
set PROGDIR=%~dp0
set SRC_ROOT=%PROGDIR%source\ proj
REM 这里是输出目录
set DATA_ROOT=%PROGDIR%data\proj
REM ctags所在路径
set EXUB_CTAGS=%PROGDIR%ctags\ctags.exe
astyle.exe --style=allman --indent=tab=8 --suffix=none --quiet --recursive %SRC_ROOT%\*.c %SRC_ROOT%\*.h %SRC_ROOT%\*.cpp
REM OPTIONAL
REM A tab separated file that contains small
REM descriptions for paths in the source tree
set PATH_DESC=%PROGDIR%paths.tsv set LOGGER="-Djava.util.logging.config.file=logging.properties" java %LOGGER% -jar %PROGDIR%opengrok.jar -W %DATA_ROOT%\configuration.xml -P -S -v -c %EXUB_CTAGS% -s %SRC_ROOT% -d %DATA_ROOT% REM OPTIONAL
java %LOGGER% -classpath %PROGDIR%opengrok.jar org.opensolaris.opengrok.web.EftarFile %PATH_DESC% %DATA_ROOT%\index\dtags.eftar
7、修改source.war source.war\WEB-INF\web.xml <context-param>
<param-name>CONFIGURATION</param-name>
<param-value>C:\OpenGrok\data\ proj\configuration.xml</param-value> <!-- 替换掉的部分 -–>;
<description>Full path to the configuration file where OpenGrok can read it's configuration</description>
</context-param> source.war\default\style.css body
{
background-color: #ffffff;
font-size: 16px; <!-- 字体大小-->
color: black;
font-family: arial, sans-serif;
/*padding: 1em;
margin: 0em;*/
}
8、运行run.bat并在glassfish中部署应用程序 运行run.bat将格式化代码,并生成交叉引用信息,将source.war添加到应用程序路径 9、在ie中打开 http://localhost:8080/proj