Terry : OpenGrok


What is OpenGrok?

"A wicked fast source browser"

OpenGrok is a fast and usable source code search and cross reference engine. It helps you search, cross-reference and navigate your source tree. It can understand various program file formats and version control histories like Mercurial, Git, SCCS, RCS, CVS, Subversion, Teamware, ClearCase, Perforce, Monotone and Bazaar. In other words it lets you grok (profoundly understand) source code and is developed in the open, hence the name OpenGrok. It is written in Java.

OpenGrok is the tool used for the OpenSolaris source browser and search.

Build OpenGrok from source

The easiest way to build (or modify) {OpenGrok is by using NetBeans (v7.2.1 and up preferred), but you can also build OpenGrok from the command line (Ant).


  • JDK 1.7 or higher
  • Apache Ant 1.8 or later
  • The source code on GitHub
  • The analyzers are generated from lex by using JFlex
  • Junit 4.x for testing if you don't have Netbeans

Checkout the source

check out source code from GitHub

git clone https://github.com/OpenGrok/OpenGrok.git 

Prepare the source for compilation

Copy JFlex.jar into the lib directory in the OpenGrok source. (If you are using NetBeans, you could alternatively add JFlex.jar to Ant's classpath at Tools->Options->Miscellaneous->Ant.

If you are running Ant from the command line, it should also work if you put JFlex.jar into your ~/.ant/lib directory.) Optionally you need junit*.jar there too.

Set Proxy for Ant

The machine is behind firewall, need to set HTTP Proxy for Ant, otherwise it won't be able to download latest lucene libraries.

 export ANT_OPTS="-Dhttp.proxyHost=www-proxy.au.oracle.com -Dhttp.proxyPort=80" 

Compile the source

If you use NetBeans you should be able to open OpenGrok as a project and build it from there. If you want to build from the command line, execute the following command

# change directory to opengrok source code directory
cd OpenGrok
# Run Apache Ant to compile source code

If the build is successful, you should now find the binaries under the dist directory.

Or if you want to use junit testing + javadoc generation target, you can try

ant default

If the build is successful, you should have javadoc in dist/javadoc directory & junit test results in build/test/results/*.xml directory.

For other setup & development tools like findbugs, checkstyle, pmd, ... please refer to README.txt in the downloaded/cloned sources.

Note that there is an experimental maven build system being implemented. If you want to help with it, we'd only be glad.

Install OpenGrok

In this case, install OpenGrok on Ubuntu.

Install Exuberant Ctags for analysis

sudo apt-get install exuberant-ctags

Download and Extract Apache Tomcat 6.0.36 to /opt/tomcat-6.0.36


How To Build OpenGrok From Source