File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 11import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
22import com.github.jk1.license.filter.LicenseBundleNormalizer
33import com.github.jk1.license.render.InventoryMarkdownReportRenderer
4+ import java.nio.file.Files
5+ import java.util.regex.Pattern
46
57plugins {
68 id(" com.github.jk1.dependency-license-report" )
@@ -162,8 +164,18 @@ tasks {
162164 delete(rootProject.file(" licenses" ))
163165 }
164166
167+ val generateLicenseReportEnabled =
168+ gradle.startParameter.taskNames.any { it.equals(" generateLicenseReport" ) }
165169 named(" generateLicenseReport" ).configure {
166170 dependsOn(cleanLicenses)
171+ finalizedBy(" :spotlessApply" )
172+ // disable licence report generation unless this task is explicitly run
173+ // the files produced by this task are used by other tasks without declaring them as dependency
174+ // which gradle considers an error
175+ enabled = enabled && generateLicenseReportEnabled
176+ }
177+ if (generateLicenseReportEnabled) {
178+ project.parent?.parent?.tasks?.getByName(" spotlessMisc" )?.dependsOn(named(" generateLicenseReport" ))
167179 }
168180}
169181
Original file line number Diff line number Diff line change 11
22# agent
33## Dependency License Report
4- _ 2025-07-21 03:47:53 UTC _
4+ _ 2025-07-21 13:02:04 PDT _
55## Apache License, Version 2.0
66
77** 1** ** Group:** ` com.fasterxml.jackson.core ` ** Name:** ` jackson-annotations ` ** Version:** ` 2.19.2 `
You can’t perform that action at this time.
0 commit comments