How to build OpenGrok from source

Lubos Kosco edited this page Nov 10, 2016 · 19 revisions

Table of Contents

How to build {OpenGrok

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

Requirements

You need the following:

  • JDK 1.8 or higher
  • Apache Ant 1.9 or later
  • The source code is located in a git repository
  • First build has to happen with ant/mvn which downloads all dependencies
  • 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

First build should download all needed dependencies, so don't get scared about missing jars.

Compile the source

If you use NetBeans you should be able to open OpenGrok as a project and build it from there(ignore "Resolve problem" for jar files other than junit, but setup a webapp server for the -web-nbproject application). If you want to build from the command line, execute the following command(it will need internet connection first time, so setup any proxies if needed):

 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