Apache Solr open-source search software
SOLR-16796: Add Maven SBOMs via cyclonedx (#1203)
Arnout Engelena42c605fb916
diff --git a/build.gradle b/build.gradleindex 9da30ad4bf7..c9193bd7b6b 100644--- a/build.gradle+++ b/build.gradle@@ -28,6 +28,7 @@ plugins {id 'net.ltgt.errorprone' version '3.1.0' apply falseid 'com.diffplug.spotless' version '6.5.2' apply falseid 'com.github.node-gradle.node' version '7.0.1' apply false+ id 'org.cyclonedx.bom' version '1.8.2' apply false}// Declare default Java versions for the entire project and for SolrJ separately@@ -134,6 +135,7 @@ apply from: file('gradle/testing/alternative-jdk-support.gradle')apply from: file('gradle/java/jar-manifest.gradle')// Publishing and releasing+apply from: file('gradle/maven/cyclonedx-bom.gradle')apply from: file('gradle/maven/defaults-maven.gradle')// IDE support, settings and specials.diff --git a/gradle/maven/cyclonedx-bom.gradle b/gradle/maven/cyclonedx-bom.gradlenew file mode 100644index 00000000000..6daa502b30c--- /dev/null+++ b/gradle/maven/cyclonedx-bom.gradle@@ -0,0 +1,61 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++// This adds CycloneDX BOM (SBOM) generation for all Solr Maven artifacts++allprojects { prj ->+ plugins.withType(JavaPlugin) {+ prj.apply plugin: 'org.cyclonedx.bom'++ ext {+ sbomDir = layout.buildDirectory.dir("sbom")+ }++ configurations {+ sbom+ }++ def baseName = prj.archivesBaseName + "-" + version + "-cyclonedx"++ cyclonedxBom {+ includeConfigs = ["runtimeClasspath"]+ skipConfigs = ["compileClasspath", "testCompileClasspath"]+ projectType = "library"+ destination = sbomDir.map(Directory::getAsFile)+ outputName = baseName+ outputFormat = "all"+ includeBomSerialNumber = true+ componentVersion = version+ }+ assemble.dependsOn cyclonedxBom++ ext {+ sbomXmlArtifact = artifacts.add('sbom', sbomDir.map(d -> d.file(baseName + ".xml"))) {+ type 'cyclonedx'+ extension = 'xml'+ classifier = 'cyclonedx'+ builtBy cyclonedxBom+ }+ sbomJsonArtifact = artifacts.add('sbom', sbomDir.map(d -> d.file(baseName + ".json"))) {+ type 'cyclonedx'+ extension = 'json'+ classifier = 'cyclonedx'+ builtBy cyclonedxBom+ }+ }+ }+}\ No newline at end of filediff --git a/gradle/maven/defaults-maven.gradle b/gradle/maven/defaults-maven.gradleindex 96e82dcc1c4..14860a688c5 100644--- a/gradle/maven/defaults-maven.gradle+++ b/gradle/maven/defaults-maven.gradle@@ -149,6 +149,10 @@ configure(subprojects.findAll { it.path in rootProject.published }) { prj ->artifact sourcesJarartifact javadocJar+ // Include SBOM artifacts+ artifact(sbomXmlArtifact)+ artifact(sbomJsonArtifact)+pom(configurePom)pom({diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex f340847f34c..1e41d5fdea6 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -169,6 +169,8 @@ Other Changes* SOLR-16503: Use Jetty HTTP2 for SyncStrategy and PeerSyncWithLeader for "recovery" operations (Sanjay Dutt, David Smiley)+* SOLR-16796: Include cyclonedx SBOMs with maven artifacts (Arnout Engelen, Houston Putman, Kevin Risden)+================== 9.6.1 ==================Bug Fixes---------------------