Open mandrachek opened 9 months ago
I was able to almost get this working, by configuring like this:
tasks.withType<CycloneDxTask>().configureEach {
setIncludedConfigs(listOf("${variant}CompileClasspath", "${variant}RuntimeClasspath"))
}
per https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/299#issuecomment-1618072286 instead of using cyclonedxBom {}
However, my project depends on many modules (android library projects), which in turn have their own dependencies. As soon as I hit the first library project I get the same errors.
instead of implementation project(':sub-project')
use implementation project(path:':sub-project', configuration: "default")
@mandrachek were you able to resolve the issue? I am facing exactly the same problem...
No. adding configuration: "default" to every dependency isn't realistic for the size of my project, so no luck. I wound up using the com.jaredsburrows.licenseReport plugin instead.
I was able to use the workaround mentioned at https://github.com/jk1/Gradle-License-Report/issues/199#issuecomment-1276371430
allprojects {
// UNCOMMENT THIS BEFORE RUNNING cyclonedxBom
// def artifactType = Attribute.of('artifactType', String)
// dependencies.attributesSchema {
// attribute(artifactType)
// }
// configurations {
// releaseRuntimeClasspath {
// attributes {
// // help gradle choose a variant:
// attribute(artifactType, 'android-classes-jar')
// }
// }
// }
}
Relevant docs:
https://docs.gradle.org/current/userguide/variant_attributes.html https://docs.gradle.org/current/userguide/variant_model.html
The hack does not work for me 🤔
Even with a fresh android project or with this example project https://github.com/android/nowinandroid I could not get it to run and create a sbom with contents.
Is there any plan to make this plugin work with Android at all?
I'm attempting to use this plugin on an Android project, running Android Gradle Plugin and Gradle versions 8.1.1, kotlin script based build.
I've added the plugin with
apply false
in my top level project, and include it my app module. However when I attempt to configure it withI get an a couple of exceptions:
The first exception is thrown even with just an empty
cyclonedxBom {}
. It appears the configuration does not work with Kotlin script (build.gradle.kts).If I attempt to run the task without the configuration I get a whole bunch of errors.
It would appear that the plugin is not android friendly (hence attempting to control the included configurations).