Versions: - spring-boot: 3.3.2 - cycloneDx plugin: 1.8.2 - java 17
I followed the instructions in SBOM support in Spring Boot 3.3
I got the following error at build time:
* Where:
Build file '/Users/myUser/Downloads/demo/build.gradle' line: 5
* What went wrong:
An exception occurred applying plugin request [id: 'org.cyclonedx.bom', version: '1.8.2']
> Failed to apply plugin 'org.cyclonedx.bom'.
> Cannot add task 'cyclonedxBom' as a task with that name already exists.
build.gradle
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.2'
id 'io.spring.dependency-management' version '1.1.6'
id 'org.cyclonedx.bom' version '1.8.2'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.named('test') {
useJUnitPlatform()
}
settings.gradle
rootProject.name = 'demo'
Comment From: wilkinsona
Thanks for the report. Unfortunately, the build.gradle that you have shared does not reproduce the problem for me. I combined it with an empty settings.gradle file. Perhaps you have some other configuration (settings.gradle or an init script perhaps) that's already applied the plugin?
If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: pgehl
I updated the description with the content of the settings.gradle. No init.gradle in the project. All the files are the ones downloaded from start.spring.io with only the cycloneDxPlugin plugin declaration in build.gradle
Comment From: pgehl
I'm sorry. I found the reason. I had a init.gradle in ~/users/myUser/.gradle from way back then.