How to configure plugin using the init script init.gradle.kts? #737
-
|
Hi, I'm developing a GitLab CI/CD component for my company to trigger Dependency Track analysis and upload. The idea is to use an I was able to run the example from the README successfully. However, I'm struggling to configure the plugin using this approach. My Gradle knowledge is limited, and after searching and trying several alternatives, I couldn't get it to work. For example, I tried: import org.cyclonedx.gradle.CyclonedxPlugin
initscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath("org.cyclonedx.bom:org.cyclonedx.bom.gradle.plugin:3.1.0")
}
}
allprojects {
apply<CyclonedxPlugin>()
extensions.configure<org.cyclonedx.gradle.CyclonedxExtension>("cyclonedxBom") {
includeConfigs = listOf("runtimeClasspath")
}
}What I actually need is to configure the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Got it working! Here it is: import org.cyclonedx.gradle.CyclonedxPlugin
import org.cyclonedx.model.Component
initscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath("org.cyclonedx.bom:org.cyclonedx.bom.gradle.plugin:3.1.0")
}
}
allprojects {
apply<CyclonedxPlugin>()
afterEvaluate {
tasks.named("cyclonedxDirectBom") {
setProperty("includeConfigs", listOf("runtimeClasspath", "compileClasspath"))
setProperty("skipConfigs", listOf("testRuntimeClasspath", "testCompileClasspath"))
setProperty("projectType", Component.Type.LIBRARY)
setProperty("schemaVersion", org.cyclonedx.Version.VERSION_16)
}
}
}
rootProject {
afterEvaluate {
tasks.named("cyclonedxBom") {
setProperty("projectType", Component.Type.LIBRARY)
setProperty("schemaVersion", org.cyclonedx.Version.VERSION_16)
}
}
} |
Beta Was this translation helpful? Give feedback.
Got it working! Here it is: