Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent 'cyclonedxBom' Gradle task to be launched during the test execution #45026

Open
celcius112 opened this issue Apr 7, 2025 · 3 comments
Assignees
Labels
for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged

Comments

@celcius112
Copy link
Contributor

When applying the CycloneDX Gradle plugin, a ./gradlew test will launch the cyclonedxBom, as the test task depends on processResources, which is now dependent of cyclonedxBom. This can be visualized using this plugin:

:test
+--- :classes
|    +--- :compileJava
|    \--- :processResources
|         \--- :cyclonedxBom
+--- :compileJava *
+--- :compileTestJava
|    +--- :classes *
|    \--- :compileJava *
\--- :testClasses
     +--- :compileTestJava *
     \--- :processTestResources

This behaviour is not blocking in any way (unless the Cyclone task fails unexpectedly), but is a strange one to see in our CI/CD.

It is of course possible to exclude this task using ./gradlew test -x cyclonedxBom.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 7, 2025
@philwebb philwebb changed the title Prevent cyclonedxBom Gradle task to be launched during the test execution Prevent 'cyclonedxBom' Gradle task to be launched during the test execution Apr 8, 2025
@philwebb
Copy link
Member

philwebb commented Apr 8, 2025

I wonder if we should refine our logic so that only task that create the archive call the cyclonedxBom task.

@philwebb philwebb added the for: team-attention An issue we'd like other members of the team to review label Apr 8, 2025
@mhalbritter
Copy link
Contributor

mhalbritter commented Apr 9, 2025

We had that in the past: #40890

We'd need to run the task in bootJar, bootWar and bootRun.

@mhalbritter
Copy link
Contributor

mhalbritter commented Apr 9, 2025

I have something working in https://github.com/mhalbritter/spring-boot/tree/mh/45026-prevent-cyclonedxbom-gradle-task-to-be-launched-during-the-test-execution - SBOM is now only executed on bootJar, bootWar and bootRun tasks.

For bootRun I had to resort to a small trick: there's a task called copySbom which copies the sbom from the CycloneDx task to a tmp directory under META-INF/sbom and then configures bootRun to add this to the classpath. Directly using the output from the CycloneDx isn't possible because it's missing the META-INF/sbom directory.

Should we label this issue as a bug or an enhancement?

@mhalbritter mhalbritter self-assigned this Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

4 participants