Skip to content
DehengYang edited this page Oct 7, 2020 · 27 revisions

Installation

GumTree requires Java 11 to run. Also we use Gradle to manage the dependencies and the build of GumTree. We therefore recommend also to have Gradle.

Prerequisites

  • You have to install srcML if you want to diff C++ and C# code
  • You have to install cgum if you want to diff C code
  • You have to install pythonparser to diff Python code

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

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.

From the sources

You can build GumTree with the following commands:

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

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 -x test, run gradlew.bat build -x test
  2. If you get an The input line is too long. The syntax of the command is incorrect. error when trying to run gumtree.bat, then you've just bumped into a Gradle issue, see comments from there for possible workarounds.

From maven

GumTree's Maven modules are available here: http://mvnrepository.com/artifact/com.github.gumtreediff.

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/.

Clone this wiki locally