CycloneDX / CycloneDX/cyclonedx-gradle-plugin

bootstrap method initialization exception

Open
#595 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
240
Forks
103
Avg merge
1d 9h
Merged PRs (30d)
11

Description

## Describe the bug

Using the plugin 2.1.x or 2.2.x with Gradle 7 produces the following exception

````
Caused by: java.lang.BootstrapMethodError: bootstrap method initialization exception
at org.cyclonedx.gradle.SbomGraphProvider.lambda$getArtifacts$4(SbomGraphProvider.java:141)
at org.cyclonedx.gradle.SbomGraphProvider.getArtifacts(SbomGraphProvider.java:164)
at org.cyclonedx.gradle.SbomGraphProvider.traverseProject(SbomGraphProvider.java:114)
at org.cyclonedx.gradle.SbomGraphProvider.call(SbomGraphProvider.java:80)
at org.cyclonedx.gradle.SbomGraphProvider.call(SbomGraphProvider.java:40)
````

However, upgrading to Gradle 8 and updating the build.gradle file config to make it compatible, solves the issue.

## To Reproduce

1. git clone https://github.com/spring-projects/spring-statemachine
2. git checkout v4.0.0-RC1
3. Create a `gradle.init` file with the following contents:

````

initscript {
repositories {
maven {
url "https://plugins.gradle.org/m2"
}
}
dependencies {
classpath "org.cyclonedx:cyclonedx-gradle-plugin:2.2.0"
}
}

allprojects{
apply plugin:org.cyclonedx.gradle.CycloneDxPlugin
cyclonedxBom {
includeConfigs = ["runtimeClasspath"]
projectType = "application"
schemaVersion = "1.5"
destination = file("build")
outputName = "bom"
outputFormat = "json"
includeBomSerialNumber = false
includeLicenseText = true
componentVersion = "2.0.0"
}
}

````
4. ./gradlew --init-script init.gradle cyclonedxBom --info --stacktrace

## Expected behavior

It produces the sbom.json file

## Environment (please complete the following information):

- OS: MacOS
- Gradle version: 7.6.1
- Java 17
- CycloneDX Plugin version 2.2.0

## Additional context

Upgrading to Gradle 8 solves the issue. Is there any compatibility matrix between the cyclonedx plugin and the gradle versions?

## Contribution

- [] I am willing to provide a fix
- [x] I will wait until somebody else fixes it

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the provided spring-statemachine checkout, init.gradle configuration, and Gradle 7.6.1 command. Start at org.cyclonedx.gradle.SbomGraphProvider, especially getArtifacts and the reported line 141, then compare behavior with Gradle 8. Done means the Gradle 7 setup produces sbom.json or the supported Gradle compatibility is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.