This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ant-antlibs-cyclonedx.git

commit fa44fa02b7803a8500a7551fb2d94c5b1e172dc8
Author: Stefan Bodewig <[email protected]>
AuthorDate: Fri Aug 14 07:05:02 2026 +0200

    deperecations in cyclonedx-core-java 13.x
---
 src/main/org/apache/ant/cyclonedx/Component.java        | 13 +++++++++----
 src/main/org/apache/ant/cyclonedx/ComponentBomTask.java |  8 +++++---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/main/org/apache/ant/cyclonedx/Component.java 
b/src/main/org/apache/ant/cyclonedx/Component.java
index 3b208fe..cea8e0e 100644
--- a/src/main/org/apache/ant/cyclonedx/Component.java
+++ b/src/main/org/apache/ant/cyclonedx/Component.java
@@ -40,6 +40,7 @@ import org.apache.tools.ant.types.resources.Union;
 
 import org.cyclonedx.Version;
 import org.cyclonedx.model.LicenseChoice;
+import org.cyclonedx.model.LicenseItem;
 import org.cyclonedx.model.OrganizationalContact;
 import org.cyclonedx.model.OrganizationalEntity;
 import org.cyclonedx.model.Property;
@@ -736,9 +737,10 @@ public class Component extends DataType {
         if (!licenses.isEmpty()) {
             // would create an empty licenses node otherwise
             LicenseChoice lc = new LicenseChoice();
-            lc.setLicenses(licenses.stream()
-                           .sorted(License.CycloneDxLicenseComparator)
-                           .collect(Collectors.toList()));
+            lc.setItems(licenses.stream()
+                        .sorted(License.CycloneDxLicenseComparator)
+                        .map(LicenseItem::ofLicense)
+                        .collect(Collectors.toList()));
             component.setLicenses(lc);
         }
         for (Component c : nestedComponents.stream()
@@ -811,7 +813,10 @@ public class Component extends DataType {
         if (licenses.isEmpty()) {
             LicenseChoice realLicenses = real.getLicenses();
             if (realLicenses != null) {
-                licenses.addAll(realLicenses.getLicenses());
+                licenses.addAll(realLicenses.getItems().stream()
+                                .filter(i -> 
LicenseItem.LicenseItemType.LICENSE.equals(i.getType()))
+                                .map(LicenseItem::getLicense)
+                                .collect(Collectors.toList()));
             }
         }
         if (externalReferences.isEmpty()) {
diff --git a/src/main/org/apache/ant/cyclonedx/ComponentBomTask.java 
b/src/main/org/apache/ant/cyclonedx/ComponentBomTask.java
index 325ea3c..eeef986 100644
--- a/src/main/org/apache/ant/cyclonedx/ComponentBomTask.java
+++ b/src/main/org/apache/ant/cyclonedx/ComponentBomTask.java
@@ -55,6 +55,7 @@ import org.cyclonedx.generators.xml.BomXmlGenerator;
 import org.cyclonedx.model.Bom;
 import org.cyclonedx.model.Dependency;
 import org.cyclonedx.model.LicenseChoice;
+import org.cyclonedx.model.LicenseItem;
 import org.cyclonedx.model.LifecycleChoice;
 import org.cyclonedx.model.Lifecycles;
 import org.cyclonedx.model.Metadata;
@@ -404,9 +405,10 @@ public class ComponentBomTask extends Task {
         }
         if (!licenses.isEmpty()) {
             LicenseChoice lc = new LicenseChoice();
-            lc.setLicenses(licenses.stream()
-                           .sorted(License.CycloneDxLicenseComparator)
-                           .collect(Collectors.toList()));
+            lc.setItems(licenses.stream()
+                        .sorted(License.CycloneDxLicenseComparator)
+                        .map(LicenseItem::ofLicense)
+                        .collect(Collectors.toList()));
             meta.setLicenses(lc);
         }
 

Reply via email to