You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "jdaugherty (via GitHub)" <gi...@apache.org> on 2025/09/19 05:49:48 UTC

[PR] feature: generate sboms for all published binary jar files [grails-core]

jdaugherty opened a new pull request, #15087:
URL: https://github.com/apache/grails-core/pull/15087

   With the recent [compromises of NPM](https://www.sonatype.com/blog/ongoing-npm-software-supply-chain-attack-exposes-new-risks), it's important we publish an SBOM.  
   
   This change generates sboms per the recommended [standard](https://cyclonedx.org/).  The files will not be published individually at this time (publish plugin needs enhancements).  Instead, the files will be published inside of the binary jar files at META-INF/sbom.json.
   
   Other notes on this PR:
   * As part of testing the cyclonedx gradle plugin, there are some quality issues with the plugin.  It does not support the latest best practices for gradle.  There is a 3.x version upcoming, but it's still alpha and has other issues (you can't set the component type).
   * I discovered we were generating jar files with just license / ASF policy files, so I've stopped generating those files as of this change (grails-dependencies-*,etc)
   * I'm not creating an aggregate sbom for the Grails framework.  Right now, an individual sbom for every project will be generated.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "matrei (via GitHub)" <gi...@apache.org>.
matrei commented on code in PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#discussion_r2371412078


##########
gradle/sbom-config.gradle:
##########
@@ -0,0 +1,242 @@
+/*
+ *  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
+ *
+ *    https://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.
+ */
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.cyclonedx.gradle.CycloneDxTask
+import org.cyclonedx.model.ExternalReference
+import org.cyclonedx.model.LicenseChoice
+import org.cyclonedx.model.License
+import org.cyclonedx.model.OrganizationalContact
+import org.cyclonedx.model.OrganizationalEntity
+import org.cyclonedx.model.Component
+
+import java.nio.charset.StandardCharsets
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+
+apply plugin: 'org.cyclonedx.bom'
+
+project.ext.setProperty('sbomOutputLocation', project.layout.buildDirectory.file("${findProperty('pomArtifactId') ?: project.name}-${projectVersion}-sbom.json"))
+
+def sbomTask = tasks.named('cyclonedxBom', CycloneDxTask)
+sbomTask.configure { CycloneDxTask it ->
+    // the 2.x version of Cyclonedx uses a legacy syntax & helpers for setting inputs so the syntax below
+    // is required until the 3.x version is GA
+    it.setProjectType(findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name())
+    it.@componentName.set(findProperty('pomArtifactId') ?: project.name)
+    it.@organizationalEntity.set(new OrganizationalEntity().tap {
+        name = 'Apache Software Foundation'
+        urls = ['https://www.apache.org/', 'https://security.apache.org/']
+        addContact(new OrganizationalContact().tap {
+            name = 'Apache Grails Development Team'
+            email = 'dev@grails.apache.org'
+        })
+    })
+    it.@licenseChoice.set(new LicenseChoice().tap {
+        addLicense(new License().tap {
+            name = 'Apache-2.0'
+            url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+        })
+    })
+
+    it.@externalReferences.set([
+            new ExternalReference().tap {
+                url = 'https://grails.apache.org/'
+                type = ExternalReference.Type.WEBSITE
+            }
+    ])
+
+    // sboms are published for the purposes of vulnerability analysis so only include the runtime classpath
+    it.@includeConfigs.set(['runtimeClasspath'])
+    it.@skipConfigs.set(['compileClasspath', 'testRuntimeClasspath'])
+
+    // turn off license text since it's base64 encoded & will inflate the jar sizes
+    it.@includeLicenseText.set(false)
+
+    // disable xml output
+    it.xmlOutput.unsetConvention()
+
+    def sbomOutputLocation = findProperty('sbomOutputLocation')
+    it.jsonOutput.set(sbomOutputLocation.get())
+    it.outputs.file(sbomOutputLocation)
+
+    // cyclonedx does not support "choosing" the license placed in the sbom
+    // see: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/16
+    it.doLast {
+        // ordered so that first value is the most preferred, this list is from https://www.apache.org/legal/resolved.html
+        def preferredLicenses = ['Apache-2.0', 'EPL-1.0', 'BSD-3-Clause', 'EPL-2.0', 'MIT', 'MIT-0', '0BSD', 'UPL-1.0', 'CC0-1.0', 'ICU', 'Xnet', 'NCSA', 'W3C', 'Zlib', 'AFL-3.0', 'MS-PL', 'PSF-2.0', 'APAFML', 'BSL-1.0', 'WTFPL', 'Unlicense', 'HPND', 'EPICS', 'TCL']
+
+        // licenses are standardized @ https://spdx.org/licenses/
+        def licenses = [
+                'Apache-2.0' : [
+                        id: 'Apache-2.0',
+                        url: 'https://www.apache.org/licenses/LICENSE-2.0'
+                ],
+                'BSD-2-Clause' : [
+                        id: 'BSD-2-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                'BSD-3-Clause' : [
+                        id: 'BSD-3-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                // Variant of Apache 1.1 license. Approved by legal LEGAL-707
+                'OpenSymphony' : [
+                        // id is optional and the opensymphony license doesn't have an SPDX id
+                        name: 'The OpenSymphony Software License, Version 1.1',
+                        url: 'https://raw.githubusercontent.com/sitemesh/sitemesh2/refs/heads/master/LICENSE.txt'
+                ],
+                'UPL-1.0' : [
+                        id: 'UPL-1.0',
+                        url: 'https://oss.oracle.com/licenses/upl/'
+                ],
+        ]
+
+        def licenseMapping = [
+                'pkg:maven/org.antlr/antlr4-runtime@4.7.2?type=jar' : 'BSD-3-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/jline/jline@2.14.6?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.jline/jline@3.23.0?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.liquibase.ext/liquibase-hibernate5@4.27.0?type=jar' : 'Apache-2.0', // maps incorrectly because of https://github.com/liquibase/liquibase/issues/2445 & the base pom does not define a license
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@25.03.1?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@22.06.2?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/opensymphony/sitemesh@2.6.0?type=jar' : 'OpenSymphony', // custom license approved by legal LEGAL-707
+                'pkg:maven/org.jruby/jzlib@1.1.5?type=jar': 'BSD-3-Clause'// https://web.archive.org/web/20240822213507/http://www.jcraft.com/jzlib/LICENSE.txt shows it's a 3 clause
+        ]
+
+        // we don't distribute these so these licenses are considered acceptable, but we still prefer ASF licenses.
+        // Require a whitelist of any case of category X licenses to prevent accidental inclusion in a distributed artifact
+        // this list will need to be updated anytime we change versions so we can revise the licenses
+        def licenseExceptions = [
+                'grails-data-hibernate5-core': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-spring-boot': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-dbmigration': [
+                        'pkg:maven/javax.xml.bind/jaxb-api@2.3.1?type=jar': 'CDDL-1.1', // api export
+                ],
+        ]
+
+        def pickLicense = { String bomRef, List licenseChoices ->
+            if(!bomRef) {
+                throw new GradleException("No bomRef found for a dependency of ${project.name}, cannot pick license")
+            }
+
+            logger.info('Picking license for {} from {} choices', bomRef, licenseChoices.size())
+            if(licenseMapping.containsKey(bomRef)) {
+                // There are several reasons that cyclone will get the license wrong, usually due to upstream not publishing information or publishing it incorrectly
+                // see the licenseMapping map above for details
+                def licenseId = licenseMapping[bomRef]
+                logger.lifecycle('Forcing license for {} to {}', bomRef, licenseId)
+
+                def licenseBlock = licenses[licenseId]
+                if(!licenseBlock) {

Review Comment:
   Space after `if`?



##########
gradle/sbom-config.gradle:
##########
@@ -0,0 +1,242 @@
+/*
+ *  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
+ *
+ *    https://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.
+ */
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.cyclonedx.gradle.CycloneDxTask
+import org.cyclonedx.model.ExternalReference
+import org.cyclonedx.model.LicenseChoice
+import org.cyclonedx.model.License
+import org.cyclonedx.model.OrganizationalContact
+import org.cyclonedx.model.OrganizationalEntity
+import org.cyclonedx.model.Component
+
+import java.nio.charset.StandardCharsets
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+
+apply plugin: 'org.cyclonedx.bom'
+
+project.ext.setProperty('sbomOutputLocation', project.layout.buildDirectory.file("${findProperty('pomArtifactId') ?: project.name}-${projectVersion}-sbom.json"))
+
+def sbomTask = tasks.named('cyclonedxBom', CycloneDxTask)
+sbomTask.configure { CycloneDxTask it ->
+    // the 2.x version of Cyclonedx uses a legacy syntax & helpers for setting inputs so the syntax below
+    // is required until the 3.x version is GA
+    it.setProjectType(findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name())
+    it.@componentName.set(findProperty('pomArtifactId') ?: project.name)
+    it.@organizationalEntity.set(new OrganizationalEntity().tap {
+        name = 'Apache Software Foundation'
+        urls = ['https://www.apache.org/', 'https://security.apache.org/']
+        addContact(new OrganizationalContact().tap {
+            name = 'Apache Grails Development Team'
+            email = 'dev@grails.apache.org'
+        })
+    })
+    it.@licenseChoice.set(new LicenseChoice().tap {
+        addLicense(new License().tap {
+            name = 'Apache-2.0'
+            url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+        })
+    })
+
+    it.@externalReferences.set([
+            new ExternalReference().tap {
+                url = 'https://grails.apache.org/'
+                type = ExternalReference.Type.WEBSITE
+            }
+    ])
+
+    // sboms are published for the purposes of vulnerability analysis so only include the runtime classpath
+    it.@includeConfigs.set(['runtimeClasspath'])
+    it.@skipConfigs.set(['compileClasspath', 'testRuntimeClasspath'])
+
+    // turn off license text since it's base64 encoded & will inflate the jar sizes
+    it.@includeLicenseText.set(false)
+
+    // disable xml output
+    it.xmlOutput.unsetConvention()
+
+    def sbomOutputLocation = findProperty('sbomOutputLocation')
+    it.jsonOutput.set(sbomOutputLocation.get())
+    it.outputs.file(sbomOutputLocation)
+
+    // cyclonedx does not support "choosing" the license placed in the sbom
+    // see: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/16
+    it.doLast {
+        // ordered so that first value is the most preferred, this list is from https://www.apache.org/legal/resolved.html
+        def preferredLicenses = ['Apache-2.0', 'EPL-1.0', 'BSD-3-Clause', 'EPL-2.0', 'MIT', 'MIT-0', '0BSD', 'UPL-1.0', 'CC0-1.0', 'ICU', 'Xnet', 'NCSA', 'W3C', 'Zlib', 'AFL-3.0', 'MS-PL', 'PSF-2.0', 'APAFML', 'BSL-1.0', 'WTFPL', 'Unlicense', 'HPND', 'EPICS', 'TCL']

Review Comment:
   Multi-line for readability?



##########
gradle/sbom-config.gradle:
##########
@@ -0,0 +1,242 @@
+/*
+ *  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
+ *
+ *    https://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.
+ */
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.cyclonedx.gradle.CycloneDxTask
+import org.cyclonedx.model.ExternalReference
+import org.cyclonedx.model.LicenseChoice
+import org.cyclonedx.model.License
+import org.cyclonedx.model.OrganizationalContact
+import org.cyclonedx.model.OrganizationalEntity
+import org.cyclonedx.model.Component
+
+import java.nio.charset.StandardCharsets
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+
+apply plugin: 'org.cyclonedx.bom'
+
+project.ext.setProperty('sbomOutputLocation', project.layout.buildDirectory.file("${findProperty('pomArtifactId') ?: project.name}-${projectVersion}-sbom.json"))
+
+def sbomTask = tasks.named('cyclonedxBom', CycloneDxTask)
+sbomTask.configure { CycloneDxTask it ->
+    // the 2.x version of Cyclonedx uses a legacy syntax & helpers for setting inputs so the syntax below
+    // is required until the 3.x version is GA
+    it.setProjectType(findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name())
+    it.@componentName.set(findProperty('pomArtifactId') ?: project.name)
+    it.@organizationalEntity.set(new OrganizationalEntity().tap {
+        name = 'Apache Software Foundation'
+        urls = ['https://www.apache.org/', 'https://security.apache.org/']
+        addContact(new OrganizationalContact().tap {
+            name = 'Apache Grails Development Team'
+            email = 'dev@grails.apache.org'
+        })
+    })
+    it.@licenseChoice.set(new LicenseChoice().tap {
+        addLicense(new License().tap {
+            name = 'Apache-2.0'
+            url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+        })
+    })
+
+    it.@externalReferences.set([
+            new ExternalReference().tap {
+                url = 'https://grails.apache.org/'
+                type = ExternalReference.Type.WEBSITE
+            }
+    ])
+
+    // sboms are published for the purposes of vulnerability analysis so only include the runtime classpath
+    it.@includeConfigs.set(['runtimeClasspath'])
+    it.@skipConfigs.set(['compileClasspath', 'testRuntimeClasspath'])
+
+    // turn off license text since it's base64 encoded & will inflate the jar sizes
+    it.@includeLicenseText.set(false)
+
+    // disable xml output
+    it.xmlOutput.unsetConvention()
+
+    def sbomOutputLocation = findProperty('sbomOutputLocation')
+    it.jsonOutput.set(sbomOutputLocation.get())
+    it.outputs.file(sbomOutputLocation)
+
+    // cyclonedx does not support "choosing" the license placed in the sbom
+    // see: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/16
+    it.doLast {
+        // ordered so that first value is the most preferred, this list is from https://www.apache.org/legal/resolved.html
+        def preferredLicenses = ['Apache-2.0', 'EPL-1.0', 'BSD-3-Clause', 'EPL-2.0', 'MIT', 'MIT-0', '0BSD', 'UPL-1.0', 'CC0-1.0', 'ICU', 'Xnet', 'NCSA', 'W3C', 'Zlib', 'AFL-3.0', 'MS-PL', 'PSF-2.0', 'APAFML', 'BSL-1.0', 'WTFPL', 'Unlicense', 'HPND', 'EPICS', 'TCL']
+
+        // licenses are standardized @ https://spdx.org/licenses/
+        def licenses = [
+                'Apache-2.0' : [
+                        id: 'Apache-2.0',
+                        url: 'https://www.apache.org/licenses/LICENSE-2.0'
+                ],
+                'BSD-2-Clause' : [
+                        id: 'BSD-2-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                'BSD-3-Clause' : [
+                        id: 'BSD-3-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                // Variant of Apache 1.1 license. Approved by legal LEGAL-707
+                'OpenSymphony' : [
+                        // id is optional and the opensymphony license doesn't have an SPDX id
+                        name: 'The OpenSymphony Software License, Version 1.1',
+                        url: 'https://raw.githubusercontent.com/sitemesh/sitemesh2/refs/heads/master/LICENSE.txt'
+                ],
+                'UPL-1.0' : [
+                        id: 'UPL-1.0',
+                        url: 'https://oss.oracle.com/licenses/upl/'
+                ],
+        ]
+
+        def licenseMapping = [
+                'pkg:maven/org.antlr/antlr4-runtime@4.7.2?type=jar' : 'BSD-3-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/jline/jline@2.14.6?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.jline/jline@3.23.0?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.liquibase.ext/liquibase-hibernate5@4.27.0?type=jar' : 'Apache-2.0', // maps incorrectly because of https://github.com/liquibase/liquibase/issues/2445 & the base pom does not define a license
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@25.03.1?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@22.06.2?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/opensymphony/sitemesh@2.6.0?type=jar' : 'OpenSymphony', // custom license approved by legal LEGAL-707
+                'pkg:maven/org.jruby/jzlib@1.1.5?type=jar': 'BSD-3-Clause'// https://web.archive.org/web/20240822213507/http://www.jcraft.com/jzlib/LICENSE.txt shows it's a 3 clause
+        ]
+
+        // we don't distribute these so these licenses are considered acceptable, but we still prefer ASF licenses.
+        // Require a whitelist of any case of category X licenses to prevent accidental inclusion in a distributed artifact
+        // this list will need to be updated anytime we change versions so we can revise the licenses
+        def licenseExceptions = [
+                'grails-data-hibernate5-core': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-spring-boot': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-dbmigration': [
+                        'pkg:maven/javax.xml.bind/jaxb-api@2.3.1?type=jar': 'CDDL-1.1', // api export
+                ],
+        ]
+
+        def pickLicense = { String bomRef, List licenseChoices ->
+            if(!bomRef) {

Review Comment:
   Space after `if`?



##########
gradle/sbom-config.gradle:
##########
@@ -0,0 +1,242 @@
+/*
+ *  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
+ *
+ *    https://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.
+ */
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.cyclonedx.gradle.CycloneDxTask
+import org.cyclonedx.model.ExternalReference
+import org.cyclonedx.model.LicenseChoice
+import org.cyclonedx.model.License
+import org.cyclonedx.model.OrganizationalContact
+import org.cyclonedx.model.OrganizationalEntity
+import org.cyclonedx.model.Component
+
+import java.nio.charset.StandardCharsets
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+
+apply plugin: 'org.cyclonedx.bom'
+
+project.ext.setProperty('sbomOutputLocation', project.layout.buildDirectory.file("${findProperty('pomArtifactId') ?: project.name}-${projectVersion}-sbom.json"))
+
+def sbomTask = tasks.named('cyclonedxBom', CycloneDxTask)
+sbomTask.configure { CycloneDxTask it ->
+    // the 2.x version of Cyclonedx uses a legacy syntax & helpers for setting inputs so the syntax below
+    // is required until the 3.x version is GA
+    it.setProjectType(findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name())
+    it.@componentName.set(findProperty('pomArtifactId') ?: project.name)
+    it.@organizationalEntity.set(new OrganizationalEntity().tap {
+        name = 'Apache Software Foundation'
+        urls = ['https://www.apache.org/', 'https://security.apache.org/']
+        addContact(new OrganizationalContact().tap {
+            name = 'Apache Grails Development Team'
+            email = 'dev@grails.apache.org'
+        })
+    })
+    it.@licenseChoice.set(new LicenseChoice().tap {
+        addLicense(new License().tap {
+            name = 'Apache-2.0'
+            url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+        })
+    })
+
+    it.@externalReferences.set([
+            new ExternalReference().tap {
+                url = 'https://grails.apache.org/'
+                type = ExternalReference.Type.WEBSITE
+            }
+    ])
+
+    // sboms are published for the purposes of vulnerability analysis so only include the runtime classpath
+    it.@includeConfigs.set(['runtimeClasspath'])
+    it.@skipConfigs.set(['compileClasspath', 'testRuntimeClasspath'])
+
+    // turn off license text since it's base64 encoded & will inflate the jar sizes
+    it.@includeLicenseText.set(false)
+
+    // disable xml output
+    it.xmlOutput.unsetConvention()
+
+    def sbomOutputLocation = findProperty('sbomOutputLocation')
+    it.jsonOutput.set(sbomOutputLocation.get())
+    it.outputs.file(sbomOutputLocation)
+
+    // cyclonedx does not support "choosing" the license placed in the sbom
+    // see: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/16
+    it.doLast {
+        // ordered so that first value is the most preferred, this list is from https://www.apache.org/legal/resolved.html
+        def preferredLicenses = ['Apache-2.0', 'EPL-1.0', 'BSD-3-Clause', 'EPL-2.0', 'MIT', 'MIT-0', '0BSD', 'UPL-1.0', 'CC0-1.0', 'ICU', 'Xnet', 'NCSA', 'W3C', 'Zlib', 'AFL-3.0', 'MS-PL', 'PSF-2.0', 'APAFML', 'BSL-1.0', 'WTFPL', 'Unlicense', 'HPND', 'EPICS', 'TCL']
+
+        // licenses are standardized @ https://spdx.org/licenses/
+        def licenses = [
+                'Apache-2.0' : [
+                        id: 'Apache-2.0',
+                        url: 'https://www.apache.org/licenses/LICENSE-2.0'
+                ],
+                'BSD-2-Clause' : [
+                        id: 'BSD-2-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                'BSD-3-Clause' : [
+                        id: 'BSD-3-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                // Variant of Apache 1.1 license. Approved by legal LEGAL-707
+                'OpenSymphony' : [
+                        // id is optional and the opensymphony license doesn't have an SPDX id
+                        name: 'The OpenSymphony Software License, Version 1.1',
+                        url: 'https://raw.githubusercontent.com/sitemesh/sitemesh2/refs/heads/master/LICENSE.txt'
+                ],
+                'UPL-1.0' : [
+                        id: 'UPL-1.0',
+                        url: 'https://oss.oracle.com/licenses/upl/'
+                ],
+        ]
+
+        def licenseMapping = [
+                'pkg:maven/org.antlr/antlr4-runtime@4.7.2?type=jar' : 'BSD-3-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/jline/jline@2.14.6?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.jline/jline@3.23.0?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.liquibase.ext/liquibase-hibernate5@4.27.0?type=jar' : 'Apache-2.0', // maps incorrectly because of https://github.com/liquibase/liquibase/issues/2445 & the base pom does not define a license
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@25.03.1?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@22.06.2?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/opensymphony/sitemesh@2.6.0?type=jar' : 'OpenSymphony', // custom license approved by legal LEGAL-707
+                'pkg:maven/org.jruby/jzlib@1.1.5?type=jar': 'BSD-3-Clause'// https://web.archive.org/web/20240822213507/http://www.jcraft.com/jzlib/LICENSE.txt shows it's a 3 clause
+        ]
+
+        // we don't distribute these so these licenses are considered acceptable, but we still prefer ASF licenses.
+        // Require a whitelist of any case of category X licenses to prevent accidental inclusion in a distributed artifact
+        // this list will need to be updated anytime we change versions so we can revise the licenses
+        def licenseExceptions = [
+                'grails-data-hibernate5-core': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-spring-boot': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-dbmigration': [
+                        'pkg:maven/javax.xml.bind/jaxb-api@2.3.1?type=jar': 'CDDL-1.1', // api export
+                ],
+        ]
+
+        def pickLicense = { String bomRef, List licenseChoices ->
+            if(!bomRef) {
+                throw new GradleException("No bomRef found for a dependency of ${project.name}, cannot pick license")
+            }
+
+            logger.info('Picking license for {} from {} choices', bomRef, licenseChoices.size())
+            if(licenseMapping.containsKey(bomRef)) {
+                // There are several reasons that cyclone will get the license wrong, usually due to upstream not publishing information or publishing it incorrectly
+                // see the licenseMapping map above for details
+                def licenseId = licenseMapping[bomRef]
+                logger.lifecycle('Forcing license for {} to {}', bomRef, licenseId)
+
+                def licenseBlock = licenses[licenseId]
+                if(!licenseBlock) {
+                    throw new GradleException("Cannot find license information for id ${licenseId} to use for bomRef ${bomRef} in project ${project.name}")
+                }
+
+                return licenseBlock
+            }
+
+            if (!(licenseChoices instanceof List) || licenseChoices.isEmpty()) {
+                throw new GradleException("No License was found for dependency: ${bomRef} in project ${project.name}")
+            }
+
+            def licenseIds = licenseChoices.findAll { it instanceof Map && it.license instanceof Map && it.license.id }
+            def foundLicense = preferredLicenses.find { p -> licenseIds.any { it.license.id == p } }
+            if (foundLicense) {
+                return licenseIds.find { it.license.id == foundLicense }
+            }
+
+            def defaultLicense = licenseChoices[0] // pick the first one found
+            def defaultLicenseId = defaultLicense.license.id as String
+            if(defaultLicenseId == null) {

Review Comment:
   Space after `if`?



##########
gradle/sbom-config.gradle:
##########
@@ -0,0 +1,242 @@
+/*
+ *  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
+ *
+ *    https://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.
+ */
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.cyclonedx.gradle.CycloneDxTask
+import org.cyclonedx.model.ExternalReference
+import org.cyclonedx.model.LicenseChoice
+import org.cyclonedx.model.License
+import org.cyclonedx.model.OrganizationalContact
+import org.cyclonedx.model.OrganizationalEntity
+import org.cyclonedx.model.Component
+
+import java.nio.charset.StandardCharsets
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+
+apply plugin: 'org.cyclonedx.bom'
+
+project.ext.setProperty('sbomOutputLocation', project.layout.buildDirectory.file("${findProperty('pomArtifactId') ?: project.name}-${projectVersion}-sbom.json"))
+
+def sbomTask = tasks.named('cyclonedxBom', CycloneDxTask)
+sbomTask.configure { CycloneDxTask it ->
+    // the 2.x version of Cyclonedx uses a legacy syntax & helpers for setting inputs so the syntax below
+    // is required until the 3.x version is GA
+    it.setProjectType(findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name())
+    it.@componentName.set(findProperty('pomArtifactId') ?: project.name)
+    it.@organizationalEntity.set(new OrganizationalEntity().tap {
+        name = 'Apache Software Foundation'
+        urls = ['https://www.apache.org/', 'https://security.apache.org/']
+        addContact(new OrganizationalContact().tap {
+            name = 'Apache Grails Development Team'
+            email = 'dev@grails.apache.org'
+        })
+    })
+    it.@licenseChoice.set(new LicenseChoice().tap {
+        addLicense(new License().tap {
+            name = 'Apache-2.0'
+            url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+        })
+    })
+
+    it.@externalReferences.set([
+            new ExternalReference().tap {
+                url = 'https://grails.apache.org/'
+                type = ExternalReference.Type.WEBSITE
+            }
+    ])
+
+    // sboms are published for the purposes of vulnerability analysis so only include the runtime classpath
+    it.@includeConfigs.set(['runtimeClasspath'])
+    it.@skipConfigs.set(['compileClasspath', 'testRuntimeClasspath'])
+
+    // turn off license text since it's base64 encoded & will inflate the jar sizes
+    it.@includeLicenseText.set(false)
+
+    // disable xml output
+    it.xmlOutput.unsetConvention()
+
+    def sbomOutputLocation = findProperty('sbomOutputLocation')
+    it.jsonOutput.set(sbomOutputLocation.get())
+    it.outputs.file(sbomOutputLocation)
+
+    // cyclonedx does not support "choosing" the license placed in the sbom
+    // see: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/16
+    it.doLast {
+        // ordered so that first value is the most preferred, this list is from https://www.apache.org/legal/resolved.html
+        def preferredLicenses = ['Apache-2.0', 'EPL-1.0', 'BSD-3-Clause', 'EPL-2.0', 'MIT', 'MIT-0', '0BSD', 'UPL-1.0', 'CC0-1.0', 'ICU', 'Xnet', 'NCSA', 'W3C', 'Zlib', 'AFL-3.0', 'MS-PL', 'PSF-2.0', 'APAFML', 'BSL-1.0', 'WTFPL', 'Unlicense', 'HPND', 'EPICS', 'TCL']
+
+        // licenses are standardized @ https://spdx.org/licenses/
+        def licenses = [
+                'Apache-2.0' : [
+                        id: 'Apache-2.0',
+                        url: 'https://www.apache.org/licenses/LICENSE-2.0'
+                ],
+                'BSD-2-Clause' : [
+                        id: 'BSD-2-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                'BSD-3-Clause' : [
+                        id: 'BSD-3-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                // Variant of Apache 1.1 license. Approved by legal LEGAL-707
+                'OpenSymphony' : [
+                        // id is optional and the opensymphony license doesn't have an SPDX id
+                        name: 'The OpenSymphony Software License, Version 1.1',
+                        url: 'https://raw.githubusercontent.com/sitemesh/sitemesh2/refs/heads/master/LICENSE.txt'
+                ],
+                'UPL-1.0' : [
+                        id: 'UPL-1.0',
+                        url: 'https://oss.oracle.com/licenses/upl/'
+                ],
+        ]
+
+        def licenseMapping = [
+                'pkg:maven/org.antlr/antlr4-runtime@4.7.2?type=jar' : 'BSD-3-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/jline/jline@2.14.6?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.jline/jline@3.23.0?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.liquibase.ext/liquibase-hibernate5@4.27.0?type=jar' : 'Apache-2.0', // maps incorrectly because of https://github.com/liquibase/liquibase/issues/2445 & the base pom does not define a license
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@25.03.1?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@22.06.2?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/opensymphony/sitemesh@2.6.0?type=jar' : 'OpenSymphony', // custom license approved by legal LEGAL-707
+                'pkg:maven/org.jruby/jzlib@1.1.5?type=jar': 'BSD-3-Clause'// https://web.archive.org/web/20240822213507/http://www.jcraft.com/jzlib/LICENSE.txt shows it's a 3 clause
+        ]
+
+        // we don't distribute these so these licenses are considered acceptable, but we still prefer ASF licenses.
+        // Require a whitelist of any case of category X licenses to prevent accidental inclusion in a distributed artifact
+        // this list will need to be updated anytime we change versions so we can revise the licenses
+        def licenseExceptions = [
+                'grails-data-hibernate5-core': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-spring-boot': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-dbmigration': [
+                        'pkg:maven/javax.xml.bind/jaxb-api@2.3.1?type=jar': 'CDDL-1.1', // api export
+                ],
+        ]
+
+        def pickLicense = { String bomRef, List licenseChoices ->
+            if(!bomRef) {
+                throw new GradleException("No bomRef found for a dependency of ${project.name}, cannot pick license")
+            }
+
+            logger.info('Picking license for {} from {} choices', bomRef, licenseChoices.size())
+            if(licenseMapping.containsKey(bomRef)) {
+                // There are several reasons that cyclone will get the license wrong, usually due to upstream not publishing information or publishing it incorrectly
+                // see the licenseMapping map above for details
+                def licenseId = licenseMapping[bomRef]
+                logger.lifecycle('Forcing license for {} to {}', bomRef, licenseId)
+
+                def licenseBlock = licenses[licenseId]
+                if(!licenseBlock) {
+                    throw new GradleException("Cannot find license information for id ${licenseId} to use for bomRef ${bomRef} in project ${project.name}")
+                }
+
+                return licenseBlock
+            }
+
+            if (!(licenseChoices instanceof List) || licenseChoices.isEmpty()) {
+                throw new GradleException("No License was found for dependency: ${bomRef} in project ${project.name}")
+            }
+
+            def licenseIds = licenseChoices.findAll { it instanceof Map && it.license instanceof Map && it.license.id }
+            def foundLicense = preferredLicenses.find { p -> licenseIds.any { it.license.id == p } }
+            if (foundLicense) {
+                return licenseIds.find { it.license.id == foundLicense }
+            }
+
+            def defaultLicense = licenseChoices[0] // pick the first one found
+            def defaultLicenseId = defaultLicense.license.id as String
+            if(defaultLicenseId == null) {
+                throw new GradleException("Could not determine License id for dependency: ${bomRef} in project ${project.name} for value ${defaultLicense}")
+            }
+            if(!(defaultLicenseId in preferredLicenses)) {
+                def projectLicenseExemptions = licenseExceptions[project.name] ?: [:]
+                def permittedLicense = projectLicenseExemptions.get(bomRef) == defaultLicenseId
+                if(!permittedLicense) {
+                    throw new GradleException("Unpermitted License found for bom dependency: ${bomRef} in project ${project.name} : ${defaultLicenseId}")
+                }
+            }
+
+            return defaultLicense
+        }
+
+        // json schema is documented here: https://cyclonedx.org/docs/1.6/json/
+        def rewriteSbom = { File f ->
+            def bom = new JsonSlurper().parse(f)
+
+            // timestamp is not reproducible: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/292
+            bom.metadata.timestamp = DateTimeFormatter.ISO_INSTANT.format(buildDate.truncatedTo(ChronoUnit.SECONDS))
+
+            // components[*].licenses
+            def comps = (bom instanceof Map && bom.components instanceof List) ? bom.components : []
+            comps.each { c ->
+                if (c instanceof Map && c.licenses instanceof List && !c.licenses.isEmpty()) {
+                    def chosen = pickLicense(c['bom-ref'] as String, c.licenses as List)
+                    if (chosen != null) {
+                        c.licenses = [chosen]
+                    }
+                }
+            }
+
+            // force the serialNumber to be reproducible by removing it & recalculating
+            bom.serialNumber = ''
+            String withOutSerial = JsonOutput.prettyPrint(JsonOutput.toJson(bom))
+            def uuid = UUID.nameUUIDFromBytes(withOutSerial.getBytes(StandardCharsets.UTF_8.name()))
+            def urn = "urn:uuid:${uuid.toString()}" as String
+            bom.serialNumber = urn
+
+            f.setText(JsonOutput.prettyPrint(JsonOutput.toJson(bom)), StandardCharsets.UTF_8.name())
+
+            logger.info('Rewrote JSON SBOM ({}) to pick preferred license', project.relativePath(f))
+        }
+
+        sbomOutputLocation.get().with { rewriteSbom(it.asFile) }
+    }
+}
+
+// for now, we only publish the sbom inside of the binary jar (our bom projects won't have a jar file)
+pluginManager.withPlugin('java') {
+    tasks.named('assemble').configure {
+        dependsOn tasks.named('cyclonedxBom')
+    }
+
+    if (!project.findProperty('skipJavaComponent')) {
+        tasks.named('jar', Jar).configure { Jar jar ->
+            jar.dependsOn tasks.named('cyclonedxBom')

Review Comment:
   Simplify?
   ```groovy
   jar.dependsOn('cyclonedxBom')
   ```



##########
gradle/sbom-config.gradle:
##########
@@ -0,0 +1,242 @@
+/*
+ *  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
+ *
+ *    https://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.
+ */
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.cyclonedx.gradle.CycloneDxTask
+import org.cyclonedx.model.ExternalReference
+import org.cyclonedx.model.LicenseChoice
+import org.cyclonedx.model.License
+import org.cyclonedx.model.OrganizationalContact
+import org.cyclonedx.model.OrganizationalEntity
+import org.cyclonedx.model.Component
+
+import java.nio.charset.StandardCharsets
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+
+apply plugin: 'org.cyclonedx.bom'
+
+project.ext.setProperty('sbomOutputLocation', project.layout.buildDirectory.file("${findProperty('pomArtifactId') ?: project.name}-${projectVersion}-sbom.json"))
+
+def sbomTask = tasks.named('cyclonedxBom', CycloneDxTask)
+sbomTask.configure { CycloneDxTask it ->
+    // the 2.x version of Cyclonedx uses a legacy syntax & helpers for setting inputs so the syntax below
+    // is required until the 3.x version is GA
+    it.setProjectType(findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name())
+    it.@componentName.set(findProperty('pomArtifactId') ?: project.name)
+    it.@organizationalEntity.set(new OrganizationalEntity().tap {
+        name = 'Apache Software Foundation'
+        urls = ['https://www.apache.org/', 'https://security.apache.org/']
+        addContact(new OrganizationalContact().tap {
+            name = 'Apache Grails Development Team'
+            email = 'dev@grails.apache.org'
+        })
+    })
+    it.@licenseChoice.set(new LicenseChoice().tap {
+        addLicense(new License().tap {
+            name = 'Apache-2.0'
+            url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+        })
+    })
+
+    it.@externalReferences.set([
+            new ExternalReference().tap {
+                url = 'https://grails.apache.org/'
+                type = ExternalReference.Type.WEBSITE
+            }
+    ])
+
+    // sboms are published for the purposes of vulnerability analysis so only include the runtime classpath
+    it.@includeConfigs.set(['runtimeClasspath'])
+    it.@skipConfigs.set(['compileClasspath', 'testRuntimeClasspath'])
+
+    // turn off license text since it's base64 encoded & will inflate the jar sizes
+    it.@includeLicenseText.set(false)
+
+    // disable xml output
+    it.xmlOutput.unsetConvention()
+
+    def sbomOutputLocation = findProperty('sbomOutputLocation')
+    it.jsonOutput.set(sbomOutputLocation.get())
+    it.outputs.file(sbomOutputLocation)
+
+    // cyclonedx does not support "choosing" the license placed in the sbom
+    // see: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/16
+    it.doLast {
+        // ordered so that first value is the most preferred, this list is from https://www.apache.org/legal/resolved.html
+        def preferredLicenses = ['Apache-2.0', 'EPL-1.0', 'BSD-3-Clause', 'EPL-2.0', 'MIT', 'MIT-0', '0BSD', 'UPL-1.0', 'CC0-1.0', 'ICU', 'Xnet', 'NCSA', 'W3C', 'Zlib', 'AFL-3.0', 'MS-PL', 'PSF-2.0', 'APAFML', 'BSL-1.0', 'WTFPL', 'Unlicense', 'HPND', 'EPICS', 'TCL']
+
+        // licenses are standardized @ https://spdx.org/licenses/
+        def licenses = [
+                'Apache-2.0' : [
+                        id: 'Apache-2.0',
+                        url: 'https://www.apache.org/licenses/LICENSE-2.0'
+                ],
+                'BSD-2-Clause' : [
+                        id: 'BSD-2-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                'BSD-3-Clause' : [
+                        id: 'BSD-3-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                // Variant of Apache 1.1 license. Approved by legal LEGAL-707
+                'OpenSymphony' : [
+                        // id is optional and the opensymphony license doesn't have an SPDX id
+                        name: 'The OpenSymphony Software License, Version 1.1',
+                        url: 'https://raw.githubusercontent.com/sitemesh/sitemesh2/refs/heads/master/LICENSE.txt'
+                ],
+                'UPL-1.0' : [
+                        id: 'UPL-1.0',
+                        url: 'https://oss.oracle.com/licenses/upl/'
+                ],
+        ]
+
+        def licenseMapping = [
+                'pkg:maven/org.antlr/antlr4-runtime@4.7.2?type=jar' : 'BSD-3-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/jline/jline@2.14.6?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.jline/jline@3.23.0?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.liquibase.ext/liquibase-hibernate5@4.27.0?type=jar' : 'Apache-2.0', // maps incorrectly because of https://github.com/liquibase/liquibase/issues/2445 & the base pom does not define a license
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@25.03.1?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@22.06.2?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/opensymphony/sitemesh@2.6.0?type=jar' : 'OpenSymphony', // custom license approved by legal LEGAL-707
+                'pkg:maven/org.jruby/jzlib@1.1.5?type=jar': 'BSD-3-Clause'// https://web.archive.org/web/20240822213507/http://www.jcraft.com/jzlib/LICENSE.txt shows it's a 3 clause
+        ]
+
+        // we don't distribute these so these licenses are considered acceptable, but we still prefer ASF licenses.
+        // Require a whitelist of any case of category X licenses to prevent accidental inclusion in a distributed artifact
+        // this list will need to be updated anytime we change versions so we can revise the licenses
+        def licenseExceptions = [
+                'grails-data-hibernate5-core': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-spring-boot': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-dbmigration': [
+                        'pkg:maven/javax.xml.bind/jaxb-api@2.3.1?type=jar': 'CDDL-1.1', // api export
+                ],
+        ]
+
+        def pickLicense = { String bomRef, List licenseChoices ->
+            if(!bomRef) {
+                throw new GradleException("No bomRef found for a dependency of ${project.name}, cannot pick license")
+            }
+
+            logger.info('Picking license for {} from {} choices', bomRef, licenseChoices.size())
+            if(licenseMapping.containsKey(bomRef)) {

Review Comment:
   Space after `if`?



##########
gradle/sbom-config.gradle:
##########
@@ -0,0 +1,242 @@
+/*
+ *  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
+ *
+ *    https://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.
+ */
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.cyclonedx.gradle.CycloneDxTask
+import org.cyclonedx.model.ExternalReference
+import org.cyclonedx.model.LicenseChoice
+import org.cyclonedx.model.License
+import org.cyclonedx.model.OrganizationalContact
+import org.cyclonedx.model.OrganizationalEntity
+import org.cyclonedx.model.Component
+
+import java.nio.charset.StandardCharsets
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+
+apply plugin: 'org.cyclonedx.bom'
+
+project.ext.setProperty('sbomOutputLocation', project.layout.buildDirectory.file("${findProperty('pomArtifactId') ?: project.name}-${projectVersion}-sbom.json"))
+
+def sbomTask = tasks.named('cyclonedxBom', CycloneDxTask)
+sbomTask.configure { CycloneDxTask it ->
+    // the 2.x version of Cyclonedx uses a legacy syntax & helpers for setting inputs so the syntax below
+    // is required until the 3.x version is GA
+    it.setProjectType(findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name())
+    it.@componentName.set(findProperty('pomArtifactId') ?: project.name)

Review Comment:
   <img width="722" height="81" alt="Screenshot_20250923_093025" src="https://github.com/user-attachments/assets/5edf0a2a-865b-4b91-944d-4d24166377d5" />
   
   ```groovy
       it.setProjectType(findProperty('sbomProjectType')?.toString() ?: Component.Type.FRAMEWORK.name())
       it.@componentName.set(findProperty('pomArtifactId')?.toString() ?: project.name)
   ```
   or
   
   ```groovy
       it.setProjectType((findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name()) as String)
       it.@componentName.set((findProperty('pomArtifactId') ?: project.name) as String)
   ```
   
   will provide the correct type (String) to the methods.



##########
gradle/sbom-config.gradle:
##########
@@ -0,0 +1,242 @@
+/*
+ *  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
+ *
+ *    https://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.
+ */
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.cyclonedx.gradle.CycloneDxTask
+import org.cyclonedx.model.ExternalReference
+import org.cyclonedx.model.LicenseChoice
+import org.cyclonedx.model.License
+import org.cyclonedx.model.OrganizationalContact
+import org.cyclonedx.model.OrganizationalEntity
+import org.cyclonedx.model.Component
+
+import java.nio.charset.StandardCharsets
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+
+apply plugin: 'org.cyclonedx.bom'
+
+project.ext.setProperty('sbomOutputLocation', project.layout.buildDirectory.file("${findProperty('pomArtifactId') ?: project.name}-${projectVersion}-sbom.json"))
+
+def sbomTask = tasks.named('cyclonedxBom', CycloneDxTask)
+sbomTask.configure { CycloneDxTask it ->
+    // the 2.x version of Cyclonedx uses a legacy syntax & helpers for setting inputs so the syntax below
+    // is required until the 3.x version is GA
+    it.setProjectType(findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name())
+    it.@componentName.set(findProperty('pomArtifactId') ?: project.name)
+    it.@organizationalEntity.set(new OrganizationalEntity().tap {
+        name = 'Apache Software Foundation'
+        urls = ['https://www.apache.org/', 'https://security.apache.org/']
+        addContact(new OrganizationalContact().tap {
+            name = 'Apache Grails Development Team'
+            email = 'dev@grails.apache.org'
+        })
+    })
+    it.@licenseChoice.set(new LicenseChoice().tap {
+        addLicense(new License().tap {
+            name = 'Apache-2.0'
+            url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+        })
+    })
+
+    it.@externalReferences.set([
+            new ExternalReference().tap {
+                url = 'https://grails.apache.org/'
+                type = ExternalReference.Type.WEBSITE
+            }
+    ])
+
+    // sboms are published for the purposes of vulnerability analysis so only include the runtime classpath
+    it.@includeConfigs.set(['runtimeClasspath'])
+    it.@skipConfigs.set(['compileClasspath', 'testRuntimeClasspath'])
+
+    // turn off license text since it's base64 encoded & will inflate the jar sizes
+    it.@includeLicenseText.set(false)
+
+    // disable xml output
+    it.xmlOutput.unsetConvention()
+
+    def sbomOutputLocation = findProperty('sbomOutputLocation')
+    it.jsonOutput.set(sbomOutputLocation.get())
+    it.outputs.file(sbomOutputLocation)
+
+    // cyclonedx does not support "choosing" the license placed in the sbom
+    // see: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/16
+    it.doLast {
+        // ordered so that first value is the most preferred, this list is from https://www.apache.org/legal/resolved.html
+        def preferredLicenses = ['Apache-2.0', 'EPL-1.0', 'BSD-3-Clause', 'EPL-2.0', 'MIT', 'MIT-0', '0BSD', 'UPL-1.0', 'CC0-1.0', 'ICU', 'Xnet', 'NCSA', 'W3C', 'Zlib', 'AFL-3.0', 'MS-PL', 'PSF-2.0', 'APAFML', 'BSL-1.0', 'WTFPL', 'Unlicense', 'HPND', 'EPICS', 'TCL']
+
+        // licenses are standardized @ https://spdx.org/licenses/
+        def licenses = [
+                'Apache-2.0' : [
+                        id: 'Apache-2.0',
+                        url: 'https://www.apache.org/licenses/LICENSE-2.0'
+                ],
+                'BSD-2-Clause' : [
+                        id: 'BSD-2-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                'BSD-3-Clause' : [
+                        id: 'BSD-3-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                // Variant of Apache 1.1 license. Approved by legal LEGAL-707
+                'OpenSymphony' : [
+                        // id is optional and the opensymphony license doesn't have an SPDX id
+                        name: 'The OpenSymphony Software License, Version 1.1',
+                        url: 'https://raw.githubusercontent.com/sitemesh/sitemesh2/refs/heads/master/LICENSE.txt'
+                ],
+                'UPL-1.0' : [
+                        id: 'UPL-1.0',
+                        url: 'https://oss.oracle.com/licenses/upl/'
+                ],
+        ]
+
+        def licenseMapping = [
+                'pkg:maven/org.antlr/antlr4-runtime@4.7.2?type=jar' : 'BSD-3-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/jline/jline@2.14.6?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.jline/jline@3.23.0?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.liquibase.ext/liquibase-hibernate5@4.27.0?type=jar' : 'Apache-2.0', // maps incorrectly because of https://github.com/liquibase/liquibase/issues/2445 & the base pom does not define a license
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@25.03.1?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@22.06.2?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/opensymphony/sitemesh@2.6.0?type=jar' : 'OpenSymphony', // custom license approved by legal LEGAL-707
+                'pkg:maven/org.jruby/jzlib@1.1.5?type=jar': 'BSD-3-Clause'// https://web.archive.org/web/20240822213507/http://www.jcraft.com/jzlib/LICENSE.txt shows it's a 3 clause
+        ]
+
+        // we don't distribute these so these licenses are considered acceptable, but we still prefer ASF licenses.
+        // Require a whitelist of any case of category X licenses to prevent accidental inclusion in a distributed artifact
+        // this list will need to be updated anytime we change versions so we can revise the licenses
+        def licenseExceptions = [
+                'grails-data-hibernate5-core': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-spring-boot': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-dbmigration': [
+                        'pkg:maven/javax.xml.bind/jaxb-api@2.3.1?type=jar': 'CDDL-1.1', // api export
+                ],
+        ]
+
+        def pickLicense = { String bomRef, List licenseChoices ->
+            if(!bomRef) {
+                throw new GradleException("No bomRef found for a dependency of ${project.name}, cannot pick license")
+            }
+
+            logger.info('Picking license for {} from {} choices', bomRef, licenseChoices.size())
+            if(licenseMapping.containsKey(bomRef)) {
+                // There are several reasons that cyclone will get the license wrong, usually due to upstream not publishing information or publishing it incorrectly
+                // see the licenseMapping map above for details
+                def licenseId = licenseMapping[bomRef]
+                logger.lifecycle('Forcing license for {} to {}', bomRef, licenseId)
+
+                def licenseBlock = licenses[licenseId]
+                if(!licenseBlock) {
+                    throw new GradleException("Cannot find license information for id ${licenseId} to use for bomRef ${bomRef} in project ${project.name}")
+                }
+
+                return licenseBlock
+            }
+
+            if (!(licenseChoices instanceof List) || licenseChoices.isEmpty()) {
+                throw new GradleException("No License was found for dependency: ${bomRef} in project ${project.name}")
+            }
+
+            def licenseIds = licenseChoices.findAll { it instanceof Map && it.license instanceof Map && it.license.id }
+            def foundLicense = preferredLicenses.find { p -> licenseIds.any { it.license.id == p } }
+            if (foundLicense) {
+                return licenseIds.find { it.license.id == foundLicense }
+            }
+
+            def defaultLicense = licenseChoices[0] // pick the first one found
+            def defaultLicenseId = defaultLicense.license.id as String
+            if(defaultLicenseId == null) {
+                throw new GradleException("Could not determine License id for dependency: ${bomRef} in project ${project.name} for value ${defaultLicense}")
+            }
+            if(!(defaultLicenseId in preferredLicenses)) {

Review Comment:
   Space after `if`?



##########
gradle/sbom-config.gradle:
##########
@@ -0,0 +1,242 @@
+/*
+ *  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
+ *
+ *    https://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.
+ */
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.cyclonedx.gradle.CycloneDxTask
+import org.cyclonedx.model.ExternalReference
+import org.cyclonedx.model.LicenseChoice
+import org.cyclonedx.model.License
+import org.cyclonedx.model.OrganizationalContact
+import org.cyclonedx.model.OrganizationalEntity
+import org.cyclonedx.model.Component
+
+import java.nio.charset.StandardCharsets
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+
+apply plugin: 'org.cyclonedx.bom'
+
+project.ext.setProperty('sbomOutputLocation', project.layout.buildDirectory.file("${findProperty('pomArtifactId') ?: project.name}-${projectVersion}-sbom.json"))
+
+def sbomTask = tasks.named('cyclonedxBom', CycloneDxTask)
+sbomTask.configure { CycloneDxTask it ->
+    // the 2.x version of Cyclonedx uses a legacy syntax & helpers for setting inputs so the syntax below
+    // is required until the 3.x version is GA
+    it.setProjectType(findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name())
+    it.@componentName.set(findProperty('pomArtifactId') ?: project.name)
+    it.@organizationalEntity.set(new OrganizationalEntity().tap {
+        name = 'Apache Software Foundation'
+        urls = ['https://www.apache.org/', 'https://security.apache.org/']
+        addContact(new OrganizationalContact().tap {
+            name = 'Apache Grails Development Team'
+            email = 'dev@grails.apache.org'
+        })
+    })
+    it.@licenseChoice.set(new LicenseChoice().tap {
+        addLicense(new License().tap {
+            name = 'Apache-2.0'
+            url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+        })
+    })
+
+    it.@externalReferences.set([
+            new ExternalReference().tap {
+                url = 'https://grails.apache.org/'
+                type = ExternalReference.Type.WEBSITE
+            }
+    ])
+
+    // sboms are published for the purposes of vulnerability analysis so only include the runtime classpath
+    it.@includeConfigs.set(['runtimeClasspath'])
+    it.@skipConfigs.set(['compileClasspath', 'testRuntimeClasspath'])
+
+    // turn off license text since it's base64 encoded & will inflate the jar sizes
+    it.@includeLicenseText.set(false)
+
+    // disable xml output
+    it.xmlOutput.unsetConvention()
+
+    def sbomOutputLocation = findProperty('sbomOutputLocation')
+    it.jsonOutput.set(sbomOutputLocation.get())
+    it.outputs.file(sbomOutputLocation)
+
+    // cyclonedx does not support "choosing" the license placed in the sbom
+    // see: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/16
+    it.doLast {
+        // ordered so that first value is the most preferred, this list is from https://www.apache.org/legal/resolved.html
+        def preferredLicenses = ['Apache-2.0', 'EPL-1.0', 'BSD-3-Clause', 'EPL-2.0', 'MIT', 'MIT-0', '0BSD', 'UPL-1.0', 'CC0-1.0', 'ICU', 'Xnet', 'NCSA', 'W3C', 'Zlib', 'AFL-3.0', 'MS-PL', 'PSF-2.0', 'APAFML', 'BSL-1.0', 'WTFPL', 'Unlicense', 'HPND', 'EPICS', 'TCL']
+
+        // licenses are standardized @ https://spdx.org/licenses/
+        def licenses = [
+                'Apache-2.0' : [
+                        id: 'Apache-2.0',
+                        url: 'https://www.apache.org/licenses/LICENSE-2.0'
+                ],
+                'BSD-2-Clause' : [
+                        id: 'BSD-2-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                'BSD-3-Clause' : [
+                        id: 'BSD-3-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                // Variant of Apache 1.1 license. Approved by legal LEGAL-707
+                'OpenSymphony' : [
+                        // id is optional and the opensymphony license doesn't have an SPDX id
+                        name: 'The OpenSymphony Software License, Version 1.1',
+                        url: 'https://raw.githubusercontent.com/sitemesh/sitemesh2/refs/heads/master/LICENSE.txt'
+                ],
+                'UPL-1.0' : [
+                        id: 'UPL-1.0',
+                        url: 'https://oss.oracle.com/licenses/upl/'
+                ],
+        ]
+
+        def licenseMapping = [
+                'pkg:maven/org.antlr/antlr4-runtime@4.7.2?type=jar' : 'BSD-3-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/jline/jline@2.14.6?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.jline/jline@3.23.0?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.liquibase.ext/liquibase-hibernate5@4.27.0?type=jar' : 'Apache-2.0', // maps incorrectly because of https://github.com/liquibase/liquibase/issues/2445 & the base pom does not define a license
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@25.03.1?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@22.06.2?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/opensymphony/sitemesh@2.6.0?type=jar' : 'OpenSymphony', // custom license approved by legal LEGAL-707
+                'pkg:maven/org.jruby/jzlib@1.1.5?type=jar': 'BSD-3-Clause'// https://web.archive.org/web/20240822213507/http://www.jcraft.com/jzlib/LICENSE.txt shows it's a 3 clause
+        ]
+
+        // we don't distribute these so these licenses are considered acceptable, but we still prefer ASF licenses.
+        // Require a whitelist of any case of category X licenses to prevent accidental inclusion in a distributed artifact
+        // this list will need to be updated anytime we change versions so we can revise the licenses
+        def licenseExceptions = [
+                'grails-data-hibernate5-core': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-spring-boot': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-dbmigration': [
+                        'pkg:maven/javax.xml.bind/jaxb-api@2.3.1?type=jar': 'CDDL-1.1', // api export
+                ],
+        ]
+
+        def pickLicense = { String bomRef, List licenseChoices ->
+            if(!bomRef) {
+                throw new GradleException("No bomRef found for a dependency of ${project.name}, cannot pick license")
+            }
+
+            logger.info('Picking license for {} from {} choices', bomRef, licenseChoices.size())
+            if(licenseMapping.containsKey(bomRef)) {
+                // There are several reasons that cyclone will get the license wrong, usually due to upstream not publishing information or publishing it incorrectly
+                // see the licenseMapping map above for details
+                def licenseId = licenseMapping[bomRef]
+                logger.lifecycle('Forcing license for {} to {}', bomRef, licenseId)
+
+                def licenseBlock = licenses[licenseId]
+                if(!licenseBlock) {
+                    throw new GradleException("Cannot find license information for id ${licenseId} to use for bomRef ${bomRef} in project ${project.name}")
+                }
+
+                return licenseBlock
+            }
+
+            if (!(licenseChoices instanceof List) || licenseChoices.isEmpty()) {
+                throw new GradleException("No License was found for dependency: ${bomRef} in project ${project.name}")
+            }
+
+            def licenseIds = licenseChoices.findAll { it instanceof Map && it.license instanceof Map && it.license.id }
+            def foundLicense = preferredLicenses.find { p -> licenseIds.any { it.license.id == p } }
+            if (foundLicense) {
+                return licenseIds.find { it.license.id == foundLicense }
+            }
+
+            def defaultLicense = licenseChoices[0] // pick the first one found
+            def defaultLicenseId = defaultLicense.license.id as String
+            if(defaultLicenseId == null) {
+                throw new GradleException("Could not determine License id for dependency: ${bomRef} in project ${project.name} for value ${defaultLicense}")
+            }
+            if(!(defaultLicenseId in preferredLicenses)) {
+                def projectLicenseExemptions = licenseExceptions[project.name] ?: [:]
+                def permittedLicense = projectLicenseExemptions.get(bomRef) == defaultLicenseId
+                if(!permittedLicense) {
+                    throw new GradleException("Unpermitted License found for bom dependency: ${bomRef} in project ${project.name} : ${defaultLicenseId}")
+                }
+            }
+
+            return defaultLicense
+        }
+
+        // json schema is documented here: https://cyclonedx.org/docs/1.6/json/
+        def rewriteSbom = { File f ->
+            def bom = new JsonSlurper().parse(f)
+
+            // timestamp is not reproducible: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/292
+            bom.metadata.timestamp = DateTimeFormatter.ISO_INSTANT.format(buildDate.truncatedTo(ChronoUnit.SECONDS))
+
+            // components[*].licenses
+            def comps = (bom instanceof Map && bom.components instanceof List) ? bom.components : []
+            comps.each { c ->
+                if (c instanceof Map && c.licenses instanceof List && !c.licenses.isEmpty()) {
+                    def chosen = pickLicense(c['bom-ref'] as String, c.licenses as List)
+                    if (chosen != null) {
+                        c.licenses = [chosen]
+                    }
+                }
+            }
+
+            // force the serialNumber to be reproducible by removing it & recalculating
+            bom.serialNumber = ''
+            String withOutSerial = JsonOutput.prettyPrint(JsonOutput.toJson(bom))
+            def uuid = UUID.nameUUIDFromBytes(withOutSerial.getBytes(StandardCharsets.UTF_8.name()))
+            def urn = "urn:uuid:${uuid.toString()}" as String
+            bom.serialNumber = urn
+
+            f.setText(JsonOutput.prettyPrint(JsonOutput.toJson(bom)), StandardCharsets.UTF_8.name())
+
+            logger.info('Rewrote JSON SBOM ({}) to pick preferred license', project.relativePath(f))
+        }
+
+        sbomOutputLocation.get().with { rewriteSbom(it.asFile) }
+    }
+}
+
+// for now, we only publish the sbom inside of the binary jar (our bom projects won't have a jar file)
+pluginManager.withPlugin('java') {
+    tasks.named('assemble').configure {
+        dependsOn tasks.named('cyclonedxBom')

Review Comment:
   Simplify?
   ```groovy
   dependsOn('cyclonedxBom')
   ```



##########
gradle/sbom-config.gradle:
##########
@@ -0,0 +1,242 @@
+/*
+ *  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
+ *
+ *    https://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.
+ */
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.cyclonedx.gradle.CycloneDxTask
+import org.cyclonedx.model.ExternalReference
+import org.cyclonedx.model.LicenseChoice
+import org.cyclonedx.model.License
+import org.cyclonedx.model.OrganizationalContact
+import org.cyclonedx.model.OrganizationalEntity
+import org.cyclonedx.model.Component
+
+import java.nio.charset.StandardCharsets
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+
+apply plugin: 'org.cyclonedx.bom'
+
+project.ext.setProperty('sbomOutputLocation', project.layout.buildDirectory.file("${findProperty('pomArtifactId') ?: project.name}-${projectVersion}-sbom.json"))
+
+def sbomTask = tasks.named('cyclonedxBom', CycloneDxTask)
+sbomTask.configure { CycloneDxTask it ->
+    // the 2.x version of Cyclonedx uses a legacy syntax & helpers for setting inputs so the syntax below
+    // is required until the 3.x version is GA
+    it.setProjectType(findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name())
+    it.@componentName.set(findProperty('pomArtifactId') ?: project.name)
+    it.@organizationalEntity.set(new OrganizationalEntity().tap {
+        name = 'Apache Software Foundation'
+        urls = ['https://www.apache.org/', 'https://security.apache.org/']
+        addContact(new OrganizationalContact().tap {
+            name = 'Apache Grails Development Team'
+            email = 'dev@grails.apache.org'
+        })
+    })
+    it.@licenseChoice.set(new LicenseChoice().tap {
+        addLicense(new License().tap {
+            name = 'Apache-2.0'
+            url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+        })
+    })
+
+    it.@externalReferences.set([
+            new ExternalReference().tap {
+                url = 'https://grails.apache.org/'
+                type = ExternalReference.Type.WEBSITE
+            }
+    ])
+
+    // sboms are published for the purposes of vulnerability analysis so only include the runtime classpath
+    it.@includeConfigs.set(['runtimeClasspath'])
+    it.@skipConfigs.set(['compileClasspath', 'testRuntimeClasspath'])
+
+    // turn off license text since it's base64 encoded & will inflate the jar sizes
+    it.@includeLicenseText.set(false)
+
+    // disable xml output
+    it.xmlOutput.unsetConvention()
+
+    def sbomOutputLocation = findProperty('sbomOutputLocation')
+    it.jsonOutput.set(sbomOutputLocation.get())
+    it.outputs.file(sbomOutputLocation)
+
+    // cyclonedx does not support "choosing" the license placed in the sbom
+    // see: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/16
+    it.doLast {
+        // ordered so that first value is the most preferred, this list is from https://www.apache.org/legal/resolved.html
+        def preferredLicenses = ['Apache-2.0', 'EPL-1.0', 'BSD-3-Clause', 'EPL-2.0', 'MIT', 'MIT-0', '0BSD', 'UPL-1.0', 'CC0-1.0', 'ICU', 'Xnet', 'NCSA', 'W3C', 'Zlib', 'AFL-3.0', 'MS-PL', 'PSF-2.0', 'APAFML', 'BSL-1.0', 'WTFPL', 'Unlicense', 'HPND', 'EPICS', 'TCL']
+
+        // licenses are standardized @ https://spdx.org/licenses/
+        def licenses = [
+                'Apache-2.0' : [
+                        id: 'Apache-2.0',
+                        url: 'https://www.apache.org/licenses/LICENSE-2.0'
+                ],
+                'BSD-2-Clause' : [
+                        id: 'BSD-2-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                'BSD-3-Clause' : [
+                        id: 'BSD-3-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                // Variant of Apache 1.1 license. Approved by legal LEGAL-707
+                'OpenSymphony' : [
+                        // id is optional and the opensymphony license doesn't have an SPDX id
+                        name: 'The OpenSymphony Software License, Version 1.1',
+                        url: 'https://raw.githubusercontent.com/sitemesh/sitemesh2/refs/heads/master/LICENSE.txt'
+                ],
+                'UPL-1.0' : [
+                        id: 'UPL-1.0',
+                        url: 'https://oss.oracle.com/licenses/upl/'
+                ],
+        ]
+
+        def licenseMapping = [
+                'pkg:maven/org.antlr/antlr4-runtime@4.7.2?type=jar' : 'BSD-3-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/jline/jline@2.14.6?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.jline/jline@3.23.0?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.liquibase.ext/liquibase-hibernate5@4.27.0?type=jar' : 'Apache-2.0', // maps incorrectly because of https://github.com/liquibase/liquibase/issues/2445 & the base pom does not define a license
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@25.03.1?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@22.06.2?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/opensymphony/sitemesh@2.6.0?type=jar' : 'OpenSymphony', // custom license approved by legal LEGAL-707
+                'pkg:maven/org.jruby/jzlib@1.1.5?type=jar': 'BSD-3-Clause'// https://web.archive.org/web/20240822213507/http://www.jcraft.com/jzlib/LICENSE.txt shows it's a 3 clause
+        ]
+
+        // we don't distribute these so these licenses are considered acceptable, but we still prefer ASF licenses.
+        // Require a whitelist of any case of category X licenses to prevent accidental inclusion in a distributed artifact
+        // this list will need to be updated anytime we change versions so we can revise the licenses
+        def licenseExceptions = [
+                'grails-data-hibernate5-core': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-spring-boot': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-dbmigration': [
+                        'pkg:maven/javax.xml.bind/jaxb-api@2.3.1?type=jar': 'CDDL-1.1', // api export
+                ],
+        ]
+
+        def pickLicense = { String bomRef, List licenseChoices ->
+            if(!bomRef) {
+                throw new GradleException("No bomRef found for a dependency of ${project.name}, cannot pick license")
+            }
+
+            logger.info('Picking license for {} from {} choices', bomRef, licenseChoices.size())
+            if(licenseMapping.containsKey(bomRef)) {
+                // There are several reasons that cyclone will get the license wrong, usually due to upstream not publishing information or publishing it incorrectly
+                // see the licenseMapping map above for details
+                def licenseId = licenseMapping[bomRef]
+                logger.lifecycle('Forcing license for {} to {}', bomRef, licenseId)
+
+                def licenseBlock = licenses[licenseId]
+                if(!licenseBlock) {
+                    throw new GradleException("Cannot find license information for id ${licenseId} to use for bomRef ${bomRef} in project ${project.name}")
+                }
+
+                return licenseBlock
+            }
+
+            if (!(licenseChoices instanceof List) || licenseChoices.isEmpty()) {
+                throw new GradleException("No License was found for dependency: ${bomRef} in project ${project.name}")
+            }
+
+            def licenseIds = licenseChoices.findAll { it instanceof Map && it.license instanceof Map && it.license.id }
+            def foundLicense = preferredLicenses.find { p -> licenseIds.any { it.license.id == p } }
+            if (foundLicense) {
+                return licenseIds.find { it.license.id == foundLicense }
+            }
+
+            def defaultLicense = licenseChoices[0] // pick the first one found
+            def defaultLicenseId = defaultLicense.license.id as String
+            if(defaultLicenseId == null) {
+                throw new GradleException("Could not determine License id for dependency: ${bomRef} in project ${project.name} for value ${defaultLicense}")
+            }
+            if(!(defaultLicenseId in preferredLicenses)) {
+                def projectLicenseExemptions = licenseExceptions[project.name] ?: [:]
+                def permittedLicense = projectLicenseExemptions.get(bomRef) == defaultLicenseId
+                if(!permittedLicense) {
+                    throw new GradleException("Unpermitted License found for bom dependency: ${bomRef} in project ${project.name} : ${defaultLicenseId}")
+                }
+            }
+
+            return defaultLicense
+        }
+
+        // json schema is documented here: https://cyclonedx.org/docs/1.6/json/
+        def rewriteSbom = { File f ->
+            def bom = new JsonSlurper().parse(f)
+
+            // timestamp is not reproducible: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/292
+            bom.metadata.timestamp = DateTimeFormatter.ISO_INSTANT.format(buildDate.truncatedTo(ChronoUnit.SECONDS))
+
+            // components[*].licenses
+            def comps = (bom instanceof Map && bom.components instanceof List) ? bom.components : []
+            comps.each { c ->
+                if (c instanceof Map && c.licenses instanceof List && !c.licenses.isEmpty()) {
+                    def chosen = pickLicense(c['bom-ref'] as String, c.licenses as List)
+                    if (chosen != null) {
+                        c.licenses = [chosen]
+                    }
+                }
+            }
+
+            // force the serialNumber to be reproducible by removing it & recalculating
+            bom.serialNumber = ''
+            String withOutSerial = JsonOutput.prettyPrint(JsonOutput.toJson(bom))
+            def uuid = UUID.nameUUIDFromBytes(withOutSerial.getBytes(StandardCharsets.UTF_8.name()))
+            def urn = "urn:uuid:${uuid.toString()}" as String
+            bom.serialNumber = urn
+
+            f.setText(JsonOutput.prettyPrint(JsonOutput.toJson(bom)), StandardCharsets.UTF_8.name())
+
+            logger.info('Rewrote JSON SBOM ({}) to pick preferred license', project.relativePath(f))
+        }
+
+        sbomOutputLocation.get().with { rewriteSbom(it.asFile) }
+    }
+}
+
+// for now, we only publish the sbom inside of the binary jar (our bom projects won't have a jar file)
+pluginManager.withPlugin('java') {
+    tasks.named('assemble').configure {
+        dependsOn tasks.named('cyclonedxBom')
+    }
+
+    if (!project.findProperty('skipJavaComponent')) {
+        tasks.named('jar', Jar).configure { Jar jar ->

Review Comment:
   Type is redundant?
   ```groovy
   tasks.named('jar').configure { Jar jar ->
   ```



##########
gradle/sbom-config.gradle:
##########
@@ -0,0 +1,242 @@
+/*
+ *  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
+ *
+ *    https://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.
+ */
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.cyclonedx.gradle.CycloneDxTask
+import org.cyclonedx.model.ExternalReference
+import org.cyclonedx.model.LicenseChoice
+import org.cyclonedx.model.License
+import org.cyclonedx.model.OrganizationalContact
+import org.cyclonedx.model.OrganizationalEntity
+import org.cyclonedx.model.Component
+
+import java.nio.charset.StandardCharsets
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+
+apply plugin: 'org.cyclonedx.bom'
+
+project.ext.setProperty('sbomOutputLocation', project.layout.buildDirectory.file("${findProperty('pomArtifactId') ?: project.name}-${projectVersion}-sbom.json"))
+
+def sbomTask = tasks.named('cyclonedxBom', CycloneDxTask)
+sbomTask.configure { CycloneDxTask it ->
+    // the 2.x version of Cyclonedx uses a legacy syntax & helpers for setting inputs so the syntax below
+    // is required until the 3.x version is GA
+    it.setProjectType(findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name())
+    it.@componentName.set(findProperty('pomArtifactId') ?: project.name)
+    it.@organizationalEntity.set(new OrganizationalEntity().tap {
+        name = 'Apache Software Foundation'
+        urls = ['https://www.apache.org/', 'https://security.apache.org/']
+        addContact(new OrganizationalContact().tap {
+            name = 'Apache Grails Development Team'
+            email = 'dev@grails.apache.org'
+        })
+    })
+    it.@licenseChoice.set(new LicenseChoice().tap {
+        addLicense(new License().tap {
+            name = 'Apache-2.0'
+            url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+        })
+    })
+
+    it.@externalReferences.set([
+            new ExternalReference().tap {
+                url = 'https://grails.apache.org/'
+                type = ExternalReference.Type.WEBSITE
+            }
+    ])
+
+    // sboms are published for the purposes of vulnerability analysis so only include the runtime classpath
+    it.@includeConfigs.set(['runtimeClasspath'])
+    it.@skipConfigs.set(['compileClasspath', 'testRuntimeClasspath'])
+
+    // turn off license text since it's base64 encoded & will inflate the jar sizes
+    it.@includeLicenseText.set(false)
+
+    // disable xml output
+    it.xmlOutput.unsetConvention()
+
+    def sbomOutputLocation = findProperty('sbomOutputLocation')
+    it.jsonOutput.set(sbomOutputLocation.get())
+    it.outputs.file(sbomOutputLocation)
+
+    // cyclonedx does not support "choosing" the license placed in the sbom
+    // see: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/16
+    it.doLast {
+        // ordered so that first value is the most preferred, this list is from https://www.apache.org/legal/resolved.html
+        def preferredLicenses = ['Apache-2.0', 'EPL-1.0', 'BSD-3-Clause', 'EPL-2.0', 'MIT', 'MIT-0', '0BSD', 'UPL-1.0', 'CC0-1.0', 'ICU', 'Xnet', 'NCSA', 'W3C', 'Zlib', 'AFL-3.0', 'MS-PL', 'PSF-2.0', 'APAFML', 'BSL-1.0', 'WTFPL', 'Unlicense', 'HPND', 'EPICS', 'TCL']
+
+        // licenses are standardized @ https://spdx.org/licenses/
+        def licenses = [
+                'Apache-2.0' : [
+                        id: 'Apache-2.0',
+                        url: 'https://www.apache.org/licenses/LICENSE-2.0'
+                ],
+                'BSD-2-Clause' : [
+                        id: 'BSD-2-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                'BSD-3-Clause' : [
+                        id: 'BSD-3-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                // Variant of Apache 1.1 license. Approved by legal LEGAL-707
+                'OpenSymphony' : [
+                        // id is optional and the opensymphony license doesn't have an SPDX id
+                        name: 'The OpenSymphony Software License, Version 1.1',
+                        url: 'https://raw.githubusercontent.com/sitemesh/sitemesh2/refs/heads/master/LICENSE.txt'
+                ],
+                'UPL-1.0' : [
+                        id: 'UPL-1.0',
+                        url: 'https://oss.oracle.com/licenses/upl/'
+                ],
+        ]
+
+        def licenseMapping = [
+                'pkg:maven/org.antlr/antlr4-runtime@4.7.2?type=jar' : 'BSD-3-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/jline/jline@2.14.6?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.jline/jline@3.23.0?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.liquibase.ext/liquibase-hibernate5@4.27.0?type=jar' : 'Apache-2.0', // maps incorrectly because of https://github.com/liquibase/liquibase/issues/2445 & the base pom does not define a license
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@25.03.1?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@22.06.2?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/opensymphony/sitemesh@2.6.0?type=jar' : 'OpenSymphony', // custom license approved by legal LEGAL-707
+                'pkg:maven/org.jruby/jzlib@1.1.5?type=jar': 'BSD-3-Clause'// https://web.archive.org/web/20240822213507/http://www.jcraft.com/jzlib/LICENSE.txt shows it's a 3 clause
+        ]
+
+        // we don't distribute these so these licenses are considered acceptable, but we still prefer ASF licenses.
+        // Require a whitelist of any case of category X licenses to prevent accidental inclusion in a distributed artifact
+        // this list will need to be updated anytime we change versions so we can revise the licenses
+        def licenseExceptions = [
+                'grails-data-hibernate5-core': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-spring-boot': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-dbmigration': [
+                        'pkg:maven/javax.xml.bind/jaxb-api@2.3.1?type=jar': 'CDDL-1.1', // api export
+                ],
+        ]
+
+        def pickLicense = { String bomRef, List licenseChoices ->
+            if(!bomRef) {
+                throw new GradleException("No bomRef found for a dependency of ${project.name}, cannot pick license")
+            }
+
+            logger.info('Picking license for {} from {} choices', bomRef, licenseChoices.size())
+            if(licenseMapping.containsKey(bomRef)) {
+                // There are several reasons that cyclone will get the license wrong, usually due to upstream not publishing information or publishing it incorrectly
+                // see the licenseMapping map above for details
+                def licenseId = licenseMapping[bomRef]
+                logger.lifecycle('Forcing license for {} to {}', bomRef, licenseId)
+
+                def licenseBlock = licenses[licenseId]
+                if(!licenseBlock) {
+                    throw new GradleException("Cannot find license information for id ${licenseId} to use for bomRef ${bomRef} in project ${project.name}")
+                }
+
+                return licenseBlock
+            }
+
+            if (!(licenseChoices instanceof List) || licenseChoices.isEmpty()) {
+                throw new GradleException("No License was found for dependency: ${bomRef} in project ${project.name}")
+            }
+
+            def licenseIds = licenseChoices.findAll { it instanceof Map && it.license instanceof Map && it.license.id }
+            def foundLicense = preferredLicenses.find { p -> licenseIds.any { it.license.id == p } }
+            if (foundLicense) {
+                return licenseIds.find { it.license.id == foundLicense }
+            }
+
+            def defaultLicense = licenseChoices[0] // pick the first one found
+            def defaultLicenseId = defaultLicense.license.id as String
+            if(defaultLicenseId == null) {
+                throw new GradleException("Could not determine License id for dependency: ${bomRef} in project ${project.name} for value ${defaultLicense}")
+            }
+            if(!(defaultLicenseId in preferredLicenses)) {
+                def projectLicenseExemptions = licenseExceptions[project.name] ?: [:]
+                def permittedLicense = projectLicenseExemptions.get(bomRef) == defaultLicenseId
+                if(!permittedLicense) {

Review Comment:
   Space after `if`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "matrei (via GitHub)" <gi...@apache.org>.
matrei commented on PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#issuecomment-3320788659

   > Why would you want to not include the license text?
   
   I was thinking about jar size.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#issuecomment-3319005366

   @matrei I populated most of the other licenses that the ASF considers acceptable from https://www.apache.org/legal/resolved.html & run on assemble as well. This fixes the error you're seeing from the spring actuator project.  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#issuecomment-3321492412

   File sizes for the hibernate-core.jar:
   1. has license text: 655K
   2. no license text: 588K
   
   I guess with the base64 encoding, zip can't optimize the sizes so it seems reasonable to turn off the text include.  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on code in PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#discussion_r2371949138


##########
gradle/sbom-config.gradle:
##########
@@ -0,0 +1,242 @@
+/*
+ *  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
+ *
+ *    https://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.
+ */
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.cyclonedx.gradle.CycloneDxTask
+import org.cyclonedx.model.ExternalReference
+import org.cyclonedx.model.LicenseChoice
+import org.cyclonedx.model.License
+import org.cyclonedx.model.OrganizationalContact
+import org.cyclonedx.model.OrganizationalEntity
+import org.cyclonedx.model.Component
+
+import java.nio.charset.StandardCharsets
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+
+apply plugin: 'org.cyclonedx.bom'
+
+project.ext.setProperty('sbomOutputLocation', project.layout.buildDirectory.file("${findProperty('pomArtifactId') ?: project.name}-${projectVersion}-sbom.json"))
+
+def sbomTask = tasks.named('cyclonedxBom', CycloneDxTask)
+sbomTask.configure { CycloneDxTask it ->
+    // the 2.x version of Cyclonedx uses a legacy syntax & helpers for setting inputs so the syntax below
+    // is required until the 3.x version is GA
+    it.setProjectType(findProperty('sbomProjectType') ?: Component.Type.FRAMEWORK.name())
+    it.@componentName.set(findProperty('pomArtifactId') ?: project.name)
+    it.@organizationalEntity.set(new OrganizationalEntity().tap {
+        name = 'Apache Software Foundation'
+        urls = ['https://www.apache.org/', 'https://security.apache.org/']
+        addContact(new OrganizationalContact().tap {
+            name = 'Apache Grails Development Team'
+            email = 'dev@grails.apache.org'
+        })
+    })
+    it.@licenseChoice.set(new LicenseChoice().tap {
+        addLicense(new License().tap {
+            name = 'Apache-2.0'
+            url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+        })
+    })
+
+    it.@externalReferences.set([
+            new ExternalReference().tap {
+                url = 'https://grails.apache.org/'
+                type = ExternalReference.Type.WEBSITE
+            }
+    ])
+
+    // sboms are published for the purposes of vulnerability analysis so only include the runtime classpath
+    it.@includeConfigs.set(['runtimeClasspath'])
+    it.@skipConfigs.set(['compileClasspath', 'testRuntimeClasspath'])
+
+    // turn off license text since it's base64 encoded & will inflate the jar sizes
+    it.@includeLicenseText.set(false)
+
+    // disable xml output
+    it.xmlOutput.unsetConvention()
+
+    def sbomOutputLocation = findProperty('sbomOutputLocation')
+    it.jsonOutput.set(sbomOutputLocation.get())
+    it.outputs.file(sbomOutputLocation)
+
+    // cyclonedx does not support "choosing" the license placed in the sbom
+    // see: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/16
+    it.doLast {
+        // ordered so that first value is the most preferred, this list is from https://www.apache.org/legal/resolved.html
+        def preferredLicenses = ['Apache-2.0', 'EPL-1.0', 'BSD-3-Clause', 'EPL-2.0', 'MIT', 'MIT-0', '0BSD', 'UPL-1.0', 'CC0-1.0', 'ICU', 'Xnet', 'NCSA', 'W3C', 'Zlib', 'AFL-3.0', 'MS-PL', 'PSF-2.0', 'APAFML', 'BSL-1.0', 'WTFPL', 'Unlicense', 'HPND', 'EPICS', 'TCL']
+
+        // licenses are standardized @ https://spdx.org/licenses/
+        def licenses = [
+                'Apache-2.0' : [
+                        id: 'Apache-2.0',
+                        url: 'https://www.apache.org/licenses/LICENSE-2.0'
+                ],
+                'BSD-2-Clause' : [
+                        id: 'BSD-2-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                'BSD-3-Clause' : [
+                        id: 'BSD-3-Clause',
+                        url: 'https://opensource.org/license/bsd-3-clause/'
+                ],
+                // Variant of Apache 1.1 license. Approved by legal LEGAL-707
+                'OpenSymphony' : [
+                        // id is optional and the opensymphony license doesn't have an SPDX id
+                        name: 'The OpenSymphony Software License, Version 1.1',
+                        url: 'https://raw.githubusercontent.com/sitemesh/sitemesh2/refs/heads/master/LICENSE.txt'
+                ],
+                'UPL-1.0' : [
+                        id: 'UPL-1.0',
+                        url: 'https://oss.oracle.com/licenses/upl/'
+                ],
+        ]
+
+        def licenseMapping = [
+                'pkg:maven/org.antlr/antlr4-runtime@4.7.2?type=jar' : 'BSD-3-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/jline/jline@2.14.6?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.jline/jline@3.23.0?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205
+                'pkg:maven/org.liquibase.ext/liquibase-hibernate5@4.27.0?type=jar' : 'Apache-2.0', // maps incorrectly because of https://github.com/liquibase/liquibase/issues/2445 & the base pom does not define a license
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@25.03.1?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/com.oracle.coherence.ce/coherence-bom@22.06.2?type=pom' : 'UPL-1.0', // does not have map based on license id
+                'pkg:maven/opensymphony/sitemesh@2.6.0?type=jar' : 'OpenSymphony', // custom license approved by legal LEGAL-707
+                'pkg:maven/org.jruby/jzlib@1.1.5?type=jar': 'BSD-3-Clause'// https://web.archive.org/web/20240822213507/http://www.jcraft.com/jzlib/LICENSE.txt shows it's a 3 clause
+        ]
+
+        // we don't distribute these so these licenses are considered acceptable, but we still prefer ASF licenses.
+        // Require a whitelist of any case of category X licenses to prevent accidental inclusion in a distributed artifact
+        // this list will need to be updated anytime we change versions so we can revise the licenses
+        def licenseExceptions = [
+                'grails-data-hibernate5-core': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-spring-boot': [
+                        'pkg:maven/org.hibernate.common/hibernate-commons-annotations@5.1.2.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                        'pkg:maven/org.hibernate/hibernate-core-jakarta@5.6.15.Final?type=jar': 'LGPL-2.1-only', // hibernate 5 is LGPL, we are migrating to ASF license in hibernate 7
+                ],
+                'grails-data-hibernate5-dbmigration': [
+                        'pkg:maven/javax.xml.bind/jaxb-api@2.3.1?type=jar': 'CDDL-1.1', // api export
+                ],
+        ]
+
+        def pickLicense = { String bomRef, List licenseChoices ->
+            if(!bomRef) {

Review Comment:
   I would have assumed codenarc was applied to our gradle files, but apparently not.  Do you know if it's possible to apply our code style rules to gradle files? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty merged PR #15087:
URL: https://github.com/apache/grails-core/pull/15087


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#issuecomment-3318826142

   The starter projects don't generate a bom so they don't run the license check by default.  I guess I could depend on assemble instead ... let me make that change and fix the fallout


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#issuecomment-3313039956

   I've gone ahead and updated this PR to also strictly validate licenses based on current versions.  This means that as we update dependencies in the future, we can adjust our exceptions/ mappings and be confident there hasn't been a license change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "matrei (via GitHub)" <gi...@apache.org>.
matrei commented on PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#issuecomment-3317282146

   I'm getting:
   ```console
   Unpermitted License found for bom dependency: pkg:maven/org.hdrhistogram/HdrHistogram@2.2.2?type=jar in project grails-dependencies-starter-web : CC0-1.0
   ```
   when running `./gradlew clean cyclonedxBom`: https://ge.grails.org/s/y74nwrngrwqtq


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "matrei (via GitHub)" <gi...@apache.org>.
matrei commented on PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#issuecomment-3320739826

   > I'm not sure if I understand this - are you proposing we don't include the text or are you asking us to?
   > 
   > The SPDX code is what identifies the license text. The cyclonedx is a json standard, so we're simply including what the upstream authors have published. Most of the licenses are included via a base64 encoding. We could technically strip the text and ensure the id is present. I'm inclined to use what the standard does by default since this is meant for security review.
   
   I'm wondering if there is any downside to set the `includeLicenseText` property to `false` (https://github.com/CycloneDX/cyclonedx-gradle-plugin?tab=readme-ov-file#configuration-properties).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#issuecomment-3320797107

   Let me check the sizes but they are zipped so I wasn’t expecting a
   significant increase.  Will circle back this afternoon.
   
   On Mon, Sep 22, 2025 at 2:44 PM Mattias Reichel ***@***.***>
   wrote:
   
   > *matrei* left a comment (apache/grails-core#15087)
   > <https://github.com/apache/grails-core/pull/15087#issuecomment-3320788659>
   >
   > Why would you want to not include the license text?
   >
   > I was thinking about jar size.
   >
   > —
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/grails-core/pull/15087#issuecomment-3320788659>,
   > or unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/AAR5JT3NYBK5LMMJMWVCLBD3UA7RFAVCNFSM6AAAAACG53WNAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGMRQG44DQNRVHE>
   > .
   > You are receiving this because you authored the thread.Message ID:
   > ***@***.***>
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#issuecomment-3320759316

   > > I'm not sure if I understand this - are you proposing we don't include the text or are you asking us to?
   > 
   > > 
   > 
   > > The SPDX code is what identifies the license text. The cyclonedx is a json standard, so we're simply including what the upstream authors have published. Most of the licenses are included via a base64 encoding. We could technically strip the text and ensure the id is present. I'm inclined to use what the standard does by default since this is meant for security review.
   > 
   > 
   > 
   > I'm wondering if there is any downside to set the `includeLicenseText` property to `false` (https://github.com/CycloneDX/cyclonedx-gradle-plugin?tab=readme-ov-file#configuration-properties).
   
   One downside is there isn't an SPDX code for the sitemesh license.  The actual standard only requires id or name though.  https://cyclonedx.org/docs/1.6/json/#tab-pane_components_items_licenses_oneOf_i0_items_license_oneOf_i0
   
   Why would you want to not include the license text?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#issuecomment-3319562081

   > Do we need to include the license texts in the SBOMs?
   
   I'm not sure if I understand this - are you proposing we don't include the text or are you asking us to?  
   
   The SPDX code is what identifies the license text.  The cyclonedx is a json standard, so we're simply including what the upstream authors have published.  Most of the licenses are included via a base64 encoding.  We could technically strip the text and ensure the id is present.  I'm inclined to use what the standard does by default since this is meant for security review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feature: generate sboms for all published binary jar files [grails-core]

Posted by "matrei (via GitHub)" <gi...@apache.org>.
matrei commented on PR #15087:
URL: https://github.com/apache/grails-core/pull/15087#issuecomment-3319120529

   Do we need to include the license texts in the SBOMs?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org