README.txt revision 975
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncOpenGrok - a wicked fast source browser
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync---------------------------------------
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncOpenGrok is a fast and usable source code search and cross reference
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncengine, written in Java. It helps you search, cross-reference and navigate
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncyour source tree. It can understand various program file formats and
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncversion control histories like SCCS, RCS, CVS, Subversion and Mercurial.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncOpenGrok is the tool used for the OpenSolaris Source Browser.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncRequirements
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync------------
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Latest Java http://java.sun.com/ (At least 1.6)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * A servlet container like Tomcat (5.x or later)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync supporting Servlet 2.4 and JSP 2.0
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Subversion 1.3.0 or later if SVN support is needed
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Mercurial 0.9.3 or later if Mercurial support is needed
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * JFlex Ant task (If you want to build OpenGrok)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncSRC_ROOT refers to the directory containing your source tree.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncOpenGrok analyzes the source tree and builds a search index along with
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynccross-referenced hypertext versions of the source files. These generated
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncdata files will be stored in DATA_ROOT directory.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncProject concept - one project is one directory underneath SRC_ROOT and
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncusually contains a checkout of a project(or it's branch, version, ...)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncsources, it can have several attributes (in its XML description), note that
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncinterface of projects is being stabilized so it can change. Projects
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynceffectively replace need for more web applications with opengrok .war and
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncleave you with one indexer and one web application serving MORE source code
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncrepositories - projects. A nice concept is to have directories underneath
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncSRC_ROOT with a naming convention, thereby creating a good overview of
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncprojects (e.g. name-version-branch). Then you have a simple update script &
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncsimple index refresher script in place, which simplifies management of more
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncrepositories.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncOpenGrok setup Step.0 - Setting up the Sources.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync----------------------------------------------
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncSource base must be available locally for OpenGrok to work efficiently. No
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncchanges are required to your source tree. If the code is under source control
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncmanagement (SCM) OpenGrok requires the checked out source tree under SRC_ROOT.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncIt is possible for some SCM systems to use a remote repository (Subversion,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncCVS), but this is not recommended due to the performance penalty. Special
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncoption is needed to enable remote repository support(-r on).
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncNote that OpenGrok ignores symbolic links.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync---------------------------------------------------
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncUsing Opengrok wrapper script(Solaris and Linux) to create indexes.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync---------------------------------------------------
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncStep.1 - Deploy the web application
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync=====================================
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncWe provided you with OpenGrok wrapper script, which should aid in deploying
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncthe web application.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncPlease change to opengrok directory (can vary on your system)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# ./OpenGrok deploy
This command will do some sanity checks and will deploy the source.war in
Note that OpenGrok script expects the directory /var/opengrok to be
XML config file, update configuration.xml to your web app
# cd /usr/opengrok/bin
and run, if your SRC_ROOT is prepared under /var/opengrok/src
configuration.xml to a running source web application.
Once above command finishes without errors(e.g. SEVERE: Failed to send
in /tank/source and I'd like to get more verbosity I'd run the indexer as:
below for our case of having opengrok instance in /tank/opengrok :
# setprop opengrok/maxmemory="2048"
Option 2. opengrok.jar: You can also directly use the Java application. If
$ java -jar opengrok.jar -s SRC_ROOT -d DATA_ROOT
See opengrok.jar manual below for more details.
Step.2 - Configure and Deploy source.war Webapp
To configure the webapp source.war, look into the parameters defined in
directory listings or search results) Example descriptions are in paths.tsv
Note 1 - Changing webapp parameters: web.xml is the deployment descriptor
for the web application. It is in a Jar file named source.war, you can
* Option 1: Unzip the file to TOMCAT/webapps/source/ directory and
change the source/WEB-INF/web.xml and other static html files like
index.html to customize to your project.
edit web.xml and re-package the jar file.
- Add the Context inside a Host element in TOMCAT/conf/server.xml
<Context path="/<webapp>" docBase="source.war">
<Parameter name="DATA_ROOT" value="/path/to/data/root" override="false" />
<Parameter name="SRC_ROOT" value="/path/to/src/root" override="false" />
`TOMCAT/conf/<engine_name>/<hostname>', where <engine_name>
Debian/Ubuntu: # apt-get install sun-java6-javadb).
$ mkdir -p $DATA_ROOT/derby
$ java -Dderby.system.home=$DATA_ROOT/derby -jar /usr/jdk/instances/jdk1.6.0/db/lib/derbynet.jar start
2) You need to have the derbyclient.jar in lib directory of opengrok.jar and in source.war WEB-INF/lib
OpenSolaris: /opt/SUNWjavadb/lib/derbyclient.jar OR /usr/jdk/instances/jdk1.6.0/db/lib/derbyclient.jar
3) Use these options with indexer when indexing/generating the configuration:
indexing and fetching of history, create a file named derby.properties in
$DATA_ROOT/derby and add this line to it:
You need to pass location of project file + the query to Search class, e.g.
for fulltext search for project with above generated configuration.xml you'd
/var/opengrok/etc/configuration.xml -f fulltext_search_string
To configure the webapp source.war, look into the parameters defined in
* localhost:<some_port> (e.g. localhost:2424), if you choose some_port
Deploy the modified .war file in glassfish/Sun Java App Server:
it to your source.war webarchive
* Option 2: Copy the source.war file to
* GLASSFISH/domains/YOURDOMAIN/autodeploy directory, glassfish will try
If you want to run Findbugs (http://findbugs.sourceforge.net/) on OpenGrok,
checked out your OpenGrok source code, under the lib/findbugs directory,
gtar -xf findbugs-x.y.z.tar.gz
mv findbugs-x.y.z findbugs
[findbugs] Output saved to findbugs/findbugs.html
Now, open findbugs/findbugs.html in a web-browser, and start fixing bugs!
later be parsed, e.g. by Hudson.
opengrok/trunk/lib directory, or ~/.ant/lib.
- libraries - Compile tab. Press the "Add JAR/Folder" and select
The classes inside opengrok.jar should now be instrumented.
If you use opengrok.jar for your own set of tests, you need
coverage data into coverage.ec.
coverage/coverage.html to see how complete your tests are.
- at least junit-4.?.jar has to be in ants classpath (e.g. in ./lib)
you can use checkstyle from http://checkstyle.sourceforge.net/
First you must download checkstyle from http://checkstyle.sourceforge.net/ ,
downloaded, and create a symbolic link to it from ~/.ant/lib/checkstyle,
e.g. like this:
unzip ~/Desktop/checkstyle-5.1.zip
unzip ~/Desktop/pmd-bin-4.2.5.zip
cd ~/.ant/lib/pmd/lib
unzip the .zip file to a directory, and use the pmd.home property
unzip ~/Desktop/jdepend-2.9.zip
cd jdepend/lib
Trond Norbye, norbye.org
Knut Pape, eBriefkasten.de