Skip to content

Gradle PluginManagement for Bnd Gradle Plugins

BJ Hargrave edited this page Feb 1, 2020 · 2 revisions

Gradle PluginManagement

Gradle 5.1 and later provides a mechanism for managing plugins. Plugins are expected to be found in the Gradle plugin repository but if hosted in other repositories require some special handling.

Due to an issue publishing version 4.3.0 of the Bnd Gradle plugin it is necessary to declare a resolutionStrategy block within the pluginManagement block as follows, making sure to also specify the repository to look in:

pluginManagement {
	resolutionStrategy {
		eachPlugin {
			if (requested.id.id == "biz.aQute.bnd.builder") {
				useModule("biz.aQute.bnd:biz.aQute.bnd.gradle:4.3.0")
			}
		}
	}

	plugins {
		id("biz.aQute.bnd.builder") version "4.3.0"
	}

	repositories {
		mavenCentral()
		gradlePluginPortal()
	}
}

The resolutionStrategy block is not needed for versions 4.3.1 and later, but you must include the repositories block with mavenCentral(). See https://github.com/bndtools/bnd/blob/master/biz.aQute.bnd.gradle/README.md#using-bnd-builder-gradle-plugin.

You may need to change the plugin id from biz.aQute.bnd.builder if you are using a different Bnd Gradle plugin.

Clone this wiki locally