Skip to content

Commit 9b6473f

Browse files
build: add bundled dependencies as provided in pom.xml
1 parent 9f29ccf commit 9b6473f

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project are documented in this file.
55
Format of the log is _loosely_ based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66
The project does _not_ follow Semantic Versioning and the changes are documented in reverse chronological order, grouped by calendar month.
77

8+
## November 2025
9+
10+
### Added
11+
- The Maven POM now contains all bundled JARs as dependencies with `provided` scope to help with automated license and
12+
vulnerability scanning.
13+
814
## October 2025
915

1016
### Added

build.gradle

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ task packageDistroWithDependencies(type: Zip, dependsOn: buildDistroWithDependen
383383

384384
assemble.dependsOn packageLanguages, packageTests
385385

386-
static def addDependency(Object pom, Object groupId, Object artifactId, Object version, Object type = null) {
386+
static def addDependency(Object pom, Object groupId, Object artifactId, Object version, Object type = null, String scope = null) {
387387
pom.withXml { XmlProvider prov ->
388388
Node root = prov.asNode()
389389
Node deps = root.dependencies[0] ?: root.appendNode("dependencies")
@@ -394,14 +394,16 @@ static def addDependency(Object pom, Object groupId, Object artifactId, Object v
394394
if (type != null) {
395395
dep.appendNode("type", type)
396396
}
397+
if (scope != null) {
398+
dep.appendNode("scope", scope)
399+
}
397400
}
398401
}
399402

400-
static def addDependency(Object pom, Configuration config) {
403+
static def addDependency(MavenPom pom, Configuration config, String scope = null) {
401404
config.resolvedConfiguration.firstLevelModuleDependencies.each {
402-
addDependency(pom, it.moduleGroup, it.moduleName, it.moduleVersion, it.moduleArtifacts[0].type)
405+
addDependency(pom, it.moduleGroup, it.moduleName, it.moduleVersion, it.moduleArtifacts[0].type, scope)
403406
}
404-
405407
}
406408

407409
ext.additionalPomInfo = {
@@ -425,6 +427,12 @@ ext.additionalPomInfo = {
425427
}
426428
}
427429

430+
ext.addBundledDependencies = { MavenPom pom ->
431+
bundledDeps.each {
432+
addDependency(pom, configurations[it.configName], 'provided')
433+
}
434+
}
435+
428436
publishing {
429437
repositories {
430438
maven {
@@ -458,6 +466,8 @@ publishing {
458466

459467
addDependency(pom, configurations.languageLibs)
460468

469+
pom addBundledDependencies
470+
461471
pom additionalPomInfo
462472
}
463473

0 commit comments

Comments
 (0)