nx-eric-jarosch opened a new pull request, #5:
URL: https://github.com/apache/ant-antlibs-cyclonedx/pull/5

   ### Motivation
   
   I noticed this issue while testing #4 
   
   When using the 'NoConflictManager' in Ivy, projects can legitimately depend 
on multiple versions of the same library.
   For example:
   ```xml
   <ivy-module version="2.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd";>
       <info module="test" organisation="com.example"/>
       <configurations>
           <conf name="default"/>
       </configurations>
       <dependencies>
                <dependency org="org.jetbrains.kotlin" 
name="kotlin-stdlib-common" rev="1.8.21"/>
                <dependency org="org.jetbrains.kotlin" 
name="kotlin-stdlib-common" rev="1.9.10"/>
                <conflict manager="all"/>
       </dependencies>
   </ivy-module>
   ```
   
   ### Previous behaviour
   
   Previously, only `1.9.10` would be included in the SBOM.
   Regardless of the ordering in the `ivy.xml`.
   
   The behaviour - I believe - was dependent on the key-ordering of this Map.
   
https://github.com/apache/ant-antlibs-cyclonedx/blob/ebc41314bfa78f5ef27516436131d978b11d7712/src/main/org/apache/ant/cyclonedx/IvyModuleComponentResolver.java#L186
   
   (Or, more likely, dependent on the hash-code of 'ModuleRevisionId', since a 
HashMap is used)
   
   ### New behaviour
   
   Now, both versions are present in the SBOM:
   ```
     "dependencies" : [
       {
         "ref" : "pkg:maven/com.example/test@working@HOSTNAME?type=jar",
         "dependsOn" : [
           
"pkg:maven/org.jetbrains.kotlin/[email protected]?type=jar",
           "pkg:maven/org.jetbrains.kotlin/[email protected]?type=jar"
         ]
       },
       {
         "ref" : 
"pkg:maven/org.jetbrains.kotlin/[email protected]?type=jar",
         "dependsOn" : [ ]
       },
       {
         "ref" : 
"pkg:maven/org.jetbrains.kotlin/[email protected]?type=jar",
         "dependsOn" : [ ]
       }
     ]
   ```
   
   #### Regression Test
   
   When using the `latest-revision` conflict manager, the expected version 
(1.9.10) is added to the SBOM.
   
   TBC


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to