cyclonedx-maven-plugin: Generated bom is invalid
In build:
<plugin>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>makeAggregateBom</goal>
</goals>
</execution>
</executions>
</plugin>
In deps:
<dependency>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
<version>2.8.1</version>
<scope>provided</scope>
</dependency>
makeAggregateBom:
[INFO]
[INFO] -----------------------< com.compamy.software:app >------------------------
[INFO] Building app 1.0.1+0
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- cyclonedx:2.8.1:makeAggregateBom (default-cli) @ app ---
[INFO] CycloneDX: Resolving Dependencies
[INFO] Artifact com.compamy.common:appx-common:pom:1.8 is present in the local repository, but cached from a remote repository ID that is unavailable in current build context, verifying that is downloadable from [sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots, default, snapshots), central (https://repo.maven.apache.org/maven2, default, releases), apache.snapshots (https://repository.apache.org/snapshots, default, snapshots), maven-default-http-blocker (http://0.0.0.0/, default, releases+snapshots, blocked), jvnet-nexus-snapshots (https://maven.java.net/content/repositories/snapshots, default, snapshots), lyo-releases (https://repo.eclipse.org/content/repositories/lyo-releases/, default, releases+snapshots), lyo-snapshots (https://repo.eclipse.org/content/repositories/lyo-snapshots/, default, releases+snapshots), apache-snapshots (https://repository.apache.org/content/groups/snapshots/, default, snapshots), jena-staging (https://repository.apache.org/content/repositories/orgapachejena-1052, default, releases), jboss (https://repository.jboss.org/nexus/content/groups/public, default, releases+snapshots), jvnet-nexus-releases (https://maven.java.net/content/repositories/releases/, default, releases)]
[INFO] Artifact com.compamy.common:appx-common:pom:1.8 is present in the local repository, but cached from a remote repository ID that is unavailable in current build context, verifying that is downloadable from [sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots, default, snapshots), central (https://repo.maven.apache.org/maven2, default, releases), apache.snapshots (https://repository.apache.org/snapshots, default, snapshots), maven-default-http-blocker (http://0.0.0.0/, default, releases+snapshots, blocked), jvnet-nexus-snapshots (https://maven.java.net/content/repositories/snapshots, default, snapshots), lyo-releases (https://repo.eclipse.org/content/repositories/lyo-releases/, default, releases+snapshots), lyo-snapshots (https://repo.eclipse.org/content/repositories/lyo-snapshots/, default, releases+snapshots), apache-snapshots (https://repository.apache.org/content/groups/snapshots/, default, snapshots), jena-staging (https://repository.apache.org/content/repositories/orgapachejena-1052, default, releases), jboss (https://repository.jboss.org/nexus/content/groups/public, default, releases+snapshots), jvnet-nexus-releases (https://maven.java.net/content/repositories/releases/, default, releases)]
[WARNING] Unable to create Maven project for com.compamy.common:appx-common:jar:1.8 from repository.
[INFO] CycloneDX: Creating BOM version 1.5 with 108 component(s)
[INFO] CycloneDX: Writing and validating BOM (XML): C:\Users\me\IdeaProjects\app\target\bom.xml
[INFO] attaching as app-1.0.1+0-cyclonedx.xml
[INFO] CycloneDX: Writing and validating BOM (JSON): C:\Users\me\IdeaProjects\app\target\bom.json
[INFO] attaching as app-1.0.1+0-cyclonedx.json
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.855 s
[INFO] Finished at: 2024-11-14T12:41:13+00:00
[INFO] ------------------------------------------------------------------------
cyclonedx-win-x64.exe validate --input-file bom.xml --input-version v1_5 --fail-on-errors
Validating XML BOM...
Validation failed at line number 2636 and position 443: The 'http://cyclonedx.org/schema/bom/1.5:url' element is invalid - The value 'https://github.com:networknt/json-schema-validator.git' is invalid according to its datatype 'Union' - The value 'https://github.com:networknt/json-schema-validator.git' is not valid according to any of the memberTypes of the union.
BOM is not valid.
cyclonedx-win-x64.exe validate --input-file bom.json --input-version v1_5 --fail-on-errors
Validating JSON BOM...
Validation failed:
Value is "object" but should be "array"
http://cyclonedx.org/schema/bom-1.5.schema.json#/properties/tools/oneOf/1
On instance: /metadata/tools:
{
"components" : [
{
"author" : "OWASP Foundation",
...
Required properties ["name"] are not present
http://cyclonedx.org/schema/bom-1.5.schema.json#/properties/lifecycles/items/oneOf/1
On instance: /metadata/lifecycles/0:
{
"phase" : "build"
}
All values fail against the false schema
http://cyclonedx.org/schema/bom-1.5.schema.json#/properties/lifecycles/items/oneOf/1/additionalProperties
On instance: /metadata/lifecycles/0/phase:
build
Value should have at most 1 items
http://cyclonedx.org/schema/bom-1.5.schema.json#/oneOf/1
On instance: /components/9/licenses:
[
{
"license" : {
"id" : "EPL-2.0"
}
},
{
"license" : {
"name" : "GNU General Public License, version 2 with the GNU Classpath Exception",
"url" : "https://www.gnu.org/software/classpath/license.html"
}
}
]
Value should have at most 1 items
and 100s of more validation fails.
Can someone tell me what am I doing wrong?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (7 by maintainers)
2.9.1 release just done, you can test if it works around the issue in jcip pom
on the empty license, it should first be improved at jcip level to have a real license listed
in parallel, perhaps you’ll be interested in #573: I did not check how jcip defined their license in their pom, but it may solve the immediate issue
#573 has been merged, but release not yet done
we need to share a reproducer to analyze together: do you have a basic project to simply build, for example on a personal GH Git repo? I don’t have time to create a pom.xml from instructions, only build from an existing content