SharedLibraryDependencies

abstract class SharedLibraryDependencies @Inject constructor(objects: ObjectFactory) : Dependencies

Dependency block for declaring peer Jenkins shared library dependencies inside sharedLibrary {}.

Each declared peer is registered with the embedded Jenkins as a Global Library, the same way an administrator would configure it under Manage Jenkins → Global Pipeline Libraries.

project(":path") works for subprojects in the same Gradle build.

GAV notation ("g:a:v") works when Gradle substitutes the coordinate with a local project — i.e. the peer is declared via includeBuild(...) in settings.gradle.kts. Resolution from a remote Maven repository is not supported yet; see issue #165.

sharedLibrary {
dependencies {
sharedLibrary(project(":config-lib")) // subproject
sharedLibrary("com.example:config-lib:1.0.0") // composite build (includeBuild)
sharedLibrary(project(":config-lib")) {
libraryName = "config" // override the Jenkins library name
implicit = false // require @Library('config') _ in pipelines
}
}
}

Constructors

Link copied to clipboard
@Inject
constructor(objects: ObjectFactory)

Properties

Link copied to clipboard
@get:Inject
abstract val dependencyConstraintFactory: DependencyConstraintFactory?
Link copied to clipboard
@get:Inject
abstract val dependencyFactory: DependencyFactory?
Link copied to clipboard
@get:Inject
abstract val objectFactory: ObjectFactory?
Link copied to clipboard
@get:Inject
abstract val project: Project?
Link copied to clipboard
abstract val sharedLibraryCollector: DependencyCollector

Feeds the sharedLibraryDependencies bucket configuration used for classpath wiring.

Link copied to clipboard
abstract val specs: ListProperty<PeerLibrarySpec>

Per-declaration metadata used at integration-test injection time to assign Jenkins library names (default: artifact / project name) and the implicit flag (default: true).

Functions

Link copied to clipboard
open fun constraint(dependencyConstraintNotation: CharSequence?): DependencyConstraint?
open fun constraint(project: ProjectDependency?): DependencyConstraint?
@Incubating
open fun constraint(dependencyConstraint: ProviderConvertible<out MinimalExternalModuleDependency?>?): Provider<out DependencyConstraint?>?
@Incubating
open fun constraint(dependencyConstraint: Provider<out MinimalExternalModuleDependency?>?): Provider<out DependencyConstraint?>?
Link copied to clipboard
open fun module(dependencyNotation: CharSequence?): ExternalModuleDependency?
open fun module(group: @Nullable String?, name: String?, version: @Nullable String?): ExternalModuleDependency?
Link copied to clipboard
open fun project(): ProjectDependency?
open fun project(projectPath: String?): ProjectDependency?
Link copied to clipboard

Declares a peer shared library by "group:artifact:version" notation.

fun sharedLibrary(project: ProjectDependency)

Declares a peer shared library from another project in this build (multi-project or composite).

fun sharedLibrary(dependency: Provider<out MinimalExternalModuleDependency>)

Declares a peer shared library from a version catalog entry.

fun sharedLibrary(notation: CharSequence, action: Action<in PeerLibrarySpec>)

Declares a peer shared library by GAV notation and applies per-library overrides.

fun sharedLibrary(project: ProjectDependency, action: Action<in PeerLibrarySpec>)

Declares a peer shared library from another project and applies per-library overrides.

fun sharedLibrary(dependency: Provider<out MinimalExternalModuleDependency>, action: Action<in PeerLibrarySpec>)

Declares a peer shared library from a version catalog entry and applies per-library overrides.