Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.bkromhout:java-diff-utils:2.1.1'
}
dependencies {
implementation("com.github.bkromhout:java-diff-utils:2.1.1")
}
<dependency>
<groupId>com.github.bkromhout</groupId>
<artifactId>java-diff-utils</artifactId>
<version>2.1.1</version>
</dependency>
libraryDependencies += "com.github.bkromhout" % "java-diff-utils" % "2.1.1"
:dependencies [[com.github.bkromhout/java-diff-utils "2.1.1"]]
The maintained successor if this library is https://github.com/java-diff-utils/java-diff-utils
A library for computing diffs, applying patches, generation side-by-side view in Java.
java-diff-utils
is an open source library for performing comparison operations between chunks of text: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future display (like a side-by-side view) and so on.
The main reason for creating this library was the lack of easy-to-use libraries with all the usual features necessary for working with diff files. Originally it was inspired by the JRCS library and its nice diff module design.
Since version 2.2.0, this fork of java-diff-utils is hosted on Maven Central. This means you can add java-diff-utils as a dependency to your project using Gradle.
Add java-diff-utils to your dependencies like this:
dependencies {
compile 'io.github.java-diff-utils:java-diff-utils:2.2.0'
}
This library implements Myers' diff algorithm, but it is modular so it is easy to replace the algorithm with another which might be better suited to your needs.
The library was originally hosted on Google Code at https://code.google.com/p/java-diff-utils/.
This library is a fork originally created by @KengoTODA (published on maven central using the group id jp.skypencil.java-diff-utils
) and enhanced by @bkromhout.
Since GitHub does not connect forks based on Google Code, other variants appeared in parallel:
This work is licensed under The Apache Software License, Version 1.1.
Reason: The code contains work of HP, which contributed it under Apache-1.1. [Example code]. It was easier to change the license to Apache-1.1 than to contact HP Legal for a code created in 2003 at HP Bristol.
I had a discussion with Juancarlo and Brian McBride. Brian worked for HPLabs in Bristol (UK) at that time. His authorship appears in three files:
All other files at JRCS are (according to Juancarlo) 100% authored by Juancarlo in a cleanroom way.
Since Brian pointed me to HP and I do not want to fight with HP, I agreed with Juancarlo to change the license of the JRCS files to Apache-1.1.
More reading on JRCS and java-diff-utils license issues: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=696165 and https://bugzilla.redhat.com/show_bug.cgi?id=1013039.
The alternative to Apache-1.1 license is to find out which code was written by Brian and to replace this code by some other clean room developed code.