2ronwalfOpenGrok - a wicked fast source browser
2ronwalf---------------------------------------
2ronwalfOpenGrok is a fast and usable source code search and cross reference
2ronwalfengine, written in Java. It helps you search, cross-reference and navigate
2ronwalfyour source tree. It can understand various program file formats and
2ronwalfversion control histories like SCCS, RCS, CVS, Subversion and Mercurial.
2ronwalfOpenGrok is the tool used for the OpenSolaris Source Browser.
2ronwalf * A servlet container like Tomcat (
5.x or later)
2ronwalf supporting Servlet 2.4 and JSP 2.0
2ronwalf * Subversion 1.3.0 or later if SVN support is needed
2ronwalf * Mercurial 0.9.3 or later if Mercurial support is needed
2ronwalf * JFlex Ant task (If you want to build OpenGrok)
SRC_ROOT refers to the directory containing your source tree.
OpenGrok analyzes the source tree and builds a search index along with
cross-referenced hypertext versions of the source files. These generated
data files will be stored in DATA_ROOT directory.
OpenGrok setup Step.0 - Setting up the Sources.
----------------------------------------------
Source base must be available locally for OpenGrok to work efficiently. No
changes are required to your source tree. If the code is under source control
management (SCM) OpenGrok requires the checked out source tree under SRC_ROOT.
It is possible for some SCM systems to use a remote repository (Subversion),
but this is not recommended due to the performance penalty. CVS must have a
Note that OpenGrok ignores symbolic links.
---------------------------------------------------
Using command line interface.
---------------------------------------------------
Step.1 - Populate DATA_ROOT Directory
=====================================
Option 1.
run.sh: There is a sample shell script
run.sh that is suitable
for using in a cronjob to run regularly. Modify the variables in the script
to point appropriate directories.
Option 2.
opengrok.jar: You can also directly use the Java application. If
the sources are all located in a directory SRC_ROOT and the data and
hypertext files generated by OpenGrok are to be stored in DATA_ROOT, run
===============================================
To configure the webapp
source.war, look into the parameters defined in
* HEADER: is the fragment of HTML that will be used to display title or
* SRC_ROOT: the absolute path name of the root directory of your source tree
* DATA_ROOT: absolute path of the directory where OpenGrok data
Optional Step.3 - Path Descriptions
-----------------------------------
OpenGrok uses path descriptions in various places (For eg. while showing
directory listings or search results) Example descriptions are in
paths.tsvfile. You can list descriptions for directories one per line tab separated
format path tab description. Refer to example 4 below.
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
edit
web.xml and re-package the jar file.
Then copy the war files to <i>TOMCAT</i>/webapps directory.
* Option 3: Edit the Context container element for the webapp
When invoking OpenGrok to build the index, use -w <webapp> to set the
After the index is built, there's a couple different ways to set the
Context for the servlet container:
<Parameter name="HEADER" value='...' override="false" />
<Parameter name="SCAN_REPOS" value="false" override="false/>
- Create a Context file for the webapp
This file will be named `<webapp>.xml'.
For Tomcat, the file will be located at:
`
TOMCAT/conf/<engine_name>/<hostname>', where <engine_name>
is the Engine that is processing requests and <hostname> is a Host
associated with that Engine. By default, this path is
This file will contain something like the Context described above.
Optional Step 4 -- Subversion setup
-----------------------------------
Some additional setup is needed if you are using Subversion. OpenGrok uses
the Subversion javahl bindings, which are requires the native library `svnjavahl'.
OpenGrok application and the OpenGrok web application.
If you need to host multiple OpenGrok web applications, do the following:
* Make sure that the path to `svnjavahl' had been added to the
only be loaded by the servlet container once for all web applications.
* Repackage
source.war. This will be the basis of your web applications.
---------------------------------------------------
Using Standalone Swing GUI
---------------------------------------------------
opengrok.jar when invoked without any arguments, opens up the GUI search window.
The interface is similar to cscope.
To create an index, first select the browse button for "Search" drop down list.
Choose a directory to store the index (DATA_ROOT), and select the source tree
(SRC_ROOT). You may have to also select path to ctags in the Advanced Options,
if exuberant ctags can not be found in the PATH.
Clicking "Update" will create or update the search index.
The index can be searched using the cscope like GUI, which lets you customize
your favorite editor to open the matching files.
Martin Englund, Sun Microsystems
Knut Anders Hatlen, Sun Microsystems