Skip to content

How to build OpenGrok from source

Lubos Kosco edited this page Mar 26, 2015 · 27 revisions

Table of Contents

How to build {OpenGrok

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

Requirements

You need the following:

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

Check out the source

The first thing you need to do is to check out the source code. You might do this from within NetBeans if you have the Mercurial plugin installed, or you can check out the source with the following command:

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

(or clone any of your forks)

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.

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:

 ant

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.

Useful Tools

Travis CI: OpenGrok on Travis

Coverity scan:

VersionEye:

Inspecting indexes: Luke - this site is abandoned, we maintain a fork on tarzanek/Luke

(get the latest luke jar from our downloads: java.net Downloads)