Skip to content
Jean-Rémy Falleri edited this page Mar 26, 2024 · 27 revisions

Installation

GumTree requires Java 17 to run.

Prerequisites

  • You have to install srcML to enable the srcML backend
  • You have to install cgum to enable the Coccinelle backend
  • You have to install pythonparser to enable the Parso backend
  • You have to install jsparser to enable the Acorn backend
  • You have to install tree-sitter-parser to enable the tree-sitter backend

All these external tools have to be available in your system's path.

Install from a release

You can download a release of GumTree directly on GitHub. Unzip the file and you will find gumtree's binaries in the bin folder.

Install from the sources

You can build GumTree with the following commands:

git clone https://github.com/GumTreeDiff/gumtree.git
cd gumtree
./gradlew build

You will have a zip distribution of GumTree in the dist/build/distributions folder. The gumtree binary is located in the bin folder contained in this archive.

Windows notes

  1. Instead of ./gradlew build, run gradlew.bat build

Install from Maven/Gradle

GumTree's Maven modules are available on Maven Central. Just add the dependency to gumtree modules as needed in pom.xml, e.g.:

    <dependency>
      <groupId>com.github.gumtreediff</groupId>
      <artifactId>core</artifactId>
      <version>3.0.0</version>
    </dependency>

If you are on gradle, declare your dependencies this way

dependencies {
    implementation 'com.github.gumtreediff:core:3.0.0'
}

Install from Docker

You can use our docker image. Follow our instructions.

Usage

From the distribution

You can unzip the archive previously described, and just run the gumtree binary suited to your system. The gumtree binary takes a command as first parameter. For instance gumtree webdiff file1.java file2.java will perform a diff and will display it in a browser.

From Java

The class containing the main method to run GumTree is com.github.gumtreediff.client.Run. You can run this class without parameters to find out the available commands. Note that if you want to have all available commands and parsers at your disposal, you need to set up the classpath to include the projects of the gumtree distribution.

For instance, the arguments webdiff file1.java file2.java will compute the diff between file1.java and file2.java, and launch a local web server that will show you the output of the diff. This server is accessible via the URL http://localhost:4567/.