Adding a Provided JAR as a Dependency in a Gradle Project

Adding a JAR as a dependency is simple in Gradle. In your dependencies {}, add the following line:

1
compile files('file.jar')

Where file.jar is the path to the JAR from the root directory of the repository. For example, if I had Dependency.jar at ./libs/Dependency.jar, I would use compile files('libs/Dependency.jar').


Thanks for reading my post! If you enjoyed it or it helped you, please consider liking/tweeting this page, commenting, or following me on GitHub or Twitter!