SBOMs für alte Java-Projekte

vorhergehende Artikel in: Java OpenSource
03.05.2025

Ich habe neulich wieder einmal über Software Bill Of Materials oder SBOMs nachgedacht - inspiriert nicht nur, aber auch von meinem $dayjob...

Was genau meine ich hier mit alte Java-Projekte? Nun, etwa solche, die schon seit vielen Jahren leben und ihr Leben vor Maven begannen. Die sQLshell zum Beispiel und dWb+ sind zwei meiner eigenen Projekte, auf die das zutrifft.

Ich hatte im $dayjob immer wenn mich jemand fragte auf das Buildmanagement mittels Maven verwiesen, das alle Informationen dazu hat, und das man benutzen kann - wenn man Zugriff auf die Quelltexte hat - um eine SBOM zu erstellen, die gewissen grundlegenden Anforderungen genügt. Dass Maven tatsächlich alle benötigten Informationen hat, kann man mittels mvn dependency:tree zeigen:

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ algorithms ---
[INFO] de.elbosso:algorithms:jar:SNAPSHOT
[INFO] +- org.apache.commons:commons-math3:jar:3.6.1:compile
[INFO] +- com.github.florianingerl.util:regex:jar:1.1.11:compile
[INFO] +- dk.brics:automaton:jar:1.12-4:compile
[INFO] +- com.basistech.tclre:tcl-regex:jar:0.14.13:compile
[INFO] |  +- com.ibm.icu:icu4j:jar:74.2:compile
[INFO] |  +- it.unimi.dsi:fastutil:jar:8.5.14:compile
[INFO] |  \- com.google.guava:guava:jar:33.3.0-jre:compile
[INFO] |     +- com.google.guava:failureaccess:jar:1.0.2:compile
[INFO] |     \- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] +- org.slf4j:slf4j-api:jar:2.0.3:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.4.4:compile
[INFO] |  \- ch.qos.logback:logback-core:jar:1.4.4:compile
[INFO] +- de.elbosso:bsh:jar:3.0.1-SNAPSHOT:compile
[INFO] |  +- de.elbosso:jedittextarea:jar:1.6.0:compile
[INFO] |  +- de.elbosso:util:jar:1.6.0:runtime
[INFO] |  |  \- de.elbosso:algorithms:jar:1.6.0:runtime
[INFO] |  +- de.elbosso:util_i18n:jar:1.6.0:runtime
[INFO] |  +- de.elbosso:ui:jar:1.6.0:compile
[INFO] |  |  \- de.elbosso:json:jar:1.6.0:compile
[INFO] |  +- de.elbosso:ui_i18n:jar:1.6.0:compile
[INFO] |  +- de.elbosso:documents:jar:1.6.0:runtime
[INFO] |  +- de.elbosso:model:jar:1.6.0:runtime
[INFO] |  |  \- de.elbosso:model_i18n:jar:1.6.0:runtime
[INFO] |  +- de.elbosso:gfx:jar:1.6.0:runtime
[INFO] |  +- org.apache.velocity:velocity:jar:1.7:runtime
[INFO] |  |  +- commons-collections:commons-collections:jar:3.2.1:runtime
[INFO] |  |  \- commons-lang:commons-lang:jar:2.4:runtime
[INFO] |  \- log4j:log4j:jar:1.2.17:runtime
[INFO] +- org.eclipse.jetty:jetty-server:jar:9.4.12.RC2:compile
[INFO] |  \- org.eclipse.jetty:jetty-io:jar:9.4.12.RC2:compile
[INFO] +- org.eclipse.jetty:jetty-servlet:jar:9.4.12.RC2:compile
[INFO] |  \- org.eclipse.jetty:jetty-security:jar:9.4.12.RC2:compile
[INFO] +- org.eclipse.jetty:jetty-util:jar:9.4.12.RC2:compile
[INFO] +- org.eclipse.jetty:jetty-http:jar:9.4.12.RC2:compile
[INFO] +- org.eclipse.jetty.websocket:websocket-server:jar:9.4.12.RC2:compile
[INFO] |  +- org.eclipse.jetty.websocket:websocket-common:jar:9.4.12.RC2:compile
[INFO] |  \- org.eclipse.jetty.websocket:websocket-client:jar:9.4.12.RC2:compile
[INFO] |     +- org.eclipse.jetty:jetty-client:jar:9.4.12.RC2:compile
[INFO] |     \- org.eclipse.jetty:jetty-xml:jar:9.4.12.RC2:compile
[INFO] +- org.eclipse.jetty.websocket:websocket-servlet:jar:9.4.12.RC2:compile
[INFO] |  \- org.eclipse.jetty.websocket:websocket-api:jar:9.4.12.RC2:compile
[INFO] +- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.4.12.RC2:compile
[INFO] |  +- org.eclipse.jetty:jetty-annotations:jar:9.4.12.RC2:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-plus:jar:9.4.12.RC2:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-jndi:jar:9.4.12.RC2:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-webapp:jar:9.4.12.RC2:compile
[INFO] |  |  +- org.ow2.asm:asm:jar:6.2:compile
[INFO] |  |  \- org.ow2.asm:asm-commons:jar:6.2:compile
[INFO] |  |     +- org.ow2.asm:asm-tree:jar:6.2:compile
[INFO] |  |     \- org.ow2.asm:asm-analysis:jar:6.2:compile
[INFO] |  +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.4.12.RC2:compile
[INFO] |  |  \- javax.websocket:javax.websocket-client-api:jar:1.0:compile
[INFO] |  \- javax.websocket:javax.websocket-api:jar:1.0:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] +- org.apache.velocity:velocity-engine-core:jar:2.3:compile
[INFO] +- net.java.linoleum:jlfgr:jar:1_0:compile
[INFO] +- com.itextpdf:itextpdf:jar:5.5.12:compile
[INFO] +- com.drewnoakes:metadata-extractor:jar:2.11.0:compile
[INFO] |  \- com.adobe.xmp:xmpcore:jar:5.1.3:compile
[INFO] +- commons-cli:commons-cli:jar:1.4:compile
[INFO] +- commons-discovery:commons-discovery:jar:0.5:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.4:compile
[INFO] +- commons-io:commons-io:jar:2.6:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.8.1:compile
[INFO] +- commons-net:commons-net:jar:3.6:compile
[INFO] +- org.codehaus.janino:janino:jar:3.0.12:compile
[INFO] |  \- org.codehaus.janino:commons-compiler:jar:3.0.12:compile
[INFO] +- org.bouncycastle:bcprov-jdk15on:jar:1.70:compile
[INFO] +- org.bouncycastle:bcpkix-jdk15on:jar:1.70:compile
[INFO] |  \- org.bouncycastle:bcutil-jdk15on:jar:1.70:compile
[INFO] +- org.bouncycastle:bcmail-jdk15on:jar:1.70:compile
[INFO] +- org.jfree:jfreechart:jar:1.5.0:compile
[INFO] +- com.trilead:trilead-ssh2:jar:1.0.0-build221:compile
[INFO] +- org.swinglabs:pdf-renderer:jar:1.0.5:compile
[INFO] +- net.sf.jtidy:jtidy:jar:r938:compile
[INFO] +- net.sourceforge.htmlcleaner:htmlcleaner:jar:2.22:compile
[INFO] |  \- org.jdom:jdom2:jar:2.0.5:compile
[INFO] +- org.igniterealtime.smack:smack-tcp:jar:4.3.1:compile
[INFO] |  \- org.igniterealtime.smack:smack-core:jar:4.3.1:compile
[INFO] |     +- xpp3:xpp3:jar:1.1.4c:compile
[INFO] |     +- org.jxmpp:jxmpp-core:jar:0.6.3:compile
[INFO] |     |  \- org.jxmpp:jxmpp-util-cache:jar:0.6.3:compile
[INFO] |     +- org.jxmpp:jxmpp-jid:jar:0.6.3:compile
[INFO] |     \- org.minidns:minidns-core:jar:0.3.3:compile
[INFO] +- org.igniterealtime.smack:smack-im:jar:4.3.1:compile
[INFO] +- org.igniterealtime.smack:smack-java7:jar:4.3.1:compile
[INFO] |  +- org.igniterealtime.smack:smack-resolver-javax:jar:4.3.1:compile
[INFO] |  \- org.igniterealtime.smack:smack-sasl-javax:jar:4.3.1:compile
[INFO] +- org.igniterealtime.smack:smack-extensions:jar:4.3.1:compile
[INFO] +- com.sun.messaging.mq:imq:jar:4.6-b01:compile
[INFO] +- com.rometools:rome:jar:1.7.4:compile
[INFO] |  \- com.rometools:rome-utils:jar:1.7.4:compile
[INFO] +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] +- javax.activation:activation:jar:1.1.1:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.3.0:compile
[INFO] +- org.hsqldb:hsqldb:jar:2.7.0:compile
[INFO] +- org.apache.poi:poi-ooxml:jar:3.5-FINAL:compile
[INFO] |  +- org.apache.poi:poi:jar:3.5-FINAL:compile
[INFO] |  +- org.apache.poi:ooxml-schemas:jar:1.0:compile
[INFO] |  \- dom4j:dom4j:jar:1.6.1:compile
[INFO] +- org.apache.poi:poi-ooxml-schemas:jar:3.6:compile
[INFO] |  +- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] |  |  \- stax:stax-api:jar:1.0.1:compile
[INFO] |  \- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0:compile
[INFO] +- xerces:xercesImpl:jar:2.9.1:compile
[INFO] |  \- xml-apis:xml-apis:jar:1.3.04:compile
[INFO] +- junit:junit:jar:4.13.2:compile
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] +- com.tngtech.archunit:archunit-junit4:jar:1.0.0:compile
[INFO] |  \- com.tngtech.archunit:archunit:jar:1.0.0:compile
[INFO] +- pl.pragmatists:JUnitParams:jar:1.1.1:compile
[INFO] +- tomcat:jasper-compiler-jdt:jar:5.5.23:compile
[INFO] |  \- org.eclipse.jdt:core:jar:3.1.1:compile
[INFO] +- net.sourceforge.cardme:cardme:jar:0.4.0:compile
[INFO] +- org.dom4j:dom4j:jar:2.0.1:compile
[INFO] |  \- jaxen:jaxen:jar:1.1.6:compile
[INFO] +- net.sourceforge.jexcelapi:jxl:jar:2.5.7:compile
[INFO] +- org.apache.ws.jaxme:jaxmexs:jar:0.5.2:compile
[INFO] +- com.google.zxing:core:jar:3.4.0:compile
[INFO] +- com.google.zxing:javase:jar:3.4.0:compile
[INFO] |  +- com.beust:jcommander:jar:1.72:compile
[INFO] |  \- com.github.jai-imageio:jai-imageio-core:jar:1.4.0:runtime
[INFO] +- org.iban4j:iban4j:jar:3.2.1:compile
[INFO] +- javax.mail:javax.mail-api:jar:1.6.2:compile
[INFO] +- org.rxtx:rxtx:jar:2.1.7:compile
[INFO] +- org.codehaus.groovy:groovy-all:jar:2.4.15:compile
[INFO] +- org.mnode.ical4j:ical4j:jar:3.0.6:compile
[INFO] |  +- commons-codec:commons-codec:jar:1.11:compile
[INFO] |  +- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] |  \- com.sun.mail:javax.mail:jar:1.6.2:compile
[INFO] +- org.cache2k:cache2k-api:jar:1.0.2.Final:compile
[INFO] +- org.apache.axis:axis:jar:1.4:compile
[INFO] +- info.picocli:picocli:jar:4.7.5:compile
[INFO] +- org.apache.httpcomponents:httpmime:jar:4.5.7:compile
[INFO] |  \- org.apache.httpcomponents:httpclient:jar:4.5.7:compile
[INFO] |     \- org.apache.httpcomponents:httpcore:jar:4.4.11:compile
[INFO] +- org.apache.xmlgraphics:batik-codec:jar:1.10:compile
[INFO] |  +- org.apache.xmlgraphics:batik-awt-util:jar:1.10:compile
[INFO] |  |  \- org.apache.xmlgraphics:xmlgraphics-commons:jar:2.2:compile
[INFO] |  +- org.apache.xmlgraphics:batik-bridge:jar:1.10:compile
[INFO] |  \- org.apache.xmlgraphics:batik-util:jar:1.10:compile
[INFO] |     +- org.apache.xmlgraphics:batik-constants:jar:1.10:compile
[INFO] |     \- org.apache.xmlgraphics:batik-i18n:jar:1.10:compile
[INFO] +- org.apache.xmlgraphics:batik-swing:jar:1.10:compile
[INFO] |  +- org.apache.xmlgraphics:batik-anim:jar:1.10:compile
[INFO] |  +- org.apache.xmlgraphics:batik-css:jar:1.10:compile
[INFO] |  +- org.apache.xmlgraphics:batik-dom:jar:1.10:compile
[INFO] |  |  \- xalan:xalan:jar:2.7.2:compile
[INFO] |  |     \- xalan:serializer:jar:2.7.2:compile
[INFO] |  +- org.apache.xmlgraphics:batik-ext:jar:1.10:compile
[INFO] |  +- org.apache.xmlgraphics:batik-gui-util:jar:1.10:compile
[INFO] |  +- org.apache.xmlgraphics:batik-gvt:jar:1.10:compile
[INFO] |  +- org.apache.xmlgraphics:batik-script:jar:1.10:compile
[INFO] |  \- xml-apis:xml-apis-ext:jar:1.3.04:compile
[INFO] +- org.apache.xmlgraphics:batik-rasterizer:jar:1.10:compile
[INFO] |  \- org.apache.xmlgraphics:batik-svgrasterizer:jar:1.10:compile
[INFO] +- org.apache.xmlgraphics:batik-extension:jar:1.10:compile
[INFO] |  +- org.apache.xmlgraphics:batik-parser:jar:1.10:compile
[INFO] |  \- org.apache.xmlgraphics:batik-svg-dom:jar:1.10:compile
[INFO] +- org.apache.xmlgraphics:batik-transcoder:jar:1.10:compile
[INFO] |  +- org.apache.xmlgraphics:batik-svggen:jar:1.10:compile
[INFO] |  \- org.apache.xmlgraphics:batik-xml:jar:1.10:compile
[INFO] +- com.panayotis.javaplot:javaplot:jar:0.5.0:compile
[INFO] +- com.github.mifmif:generex:jar:1.0.2:compile
[INFO] |  \- dk.brics.automaton:automaton:jar:1.11-8:compile
[INFO] +- io.swagger.parser.v3:swagger-parser-v3:jar:2.0.21:compile
[INFO] |  +- io.swagger.core.v3:swagger-models:jar:2.1.4:compile
[INFO] |  +- io.swagger.core.v3:swagger-core:jar:2.1.4:compile
[INFO] |  |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile
[INFO] |  |  |  \- jakarta.activation:jakarta.activation-api:jar:1.2.1:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.1:compile
[INFO] |  |  +- io.swagger.core.v3:swagger-annotations:jar:2.1.4:compile
[INFO] |  |  \- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |  +- io.swagger.parser.v3:swagger-parser-core:jar:2.0.21:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.1:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.1:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.11.1:compile
[INFO] |  \- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.11.1:compile
[INFO] |     \- org.yaml:snakeyaml:jar:1.26:compile
[INFO] +- org.apache.commons:commons-text:jar:1.9:compile
[INFO] \- javax.media:jmf:jar:2.1.1e:compile

Allerdings zeigt sich, dass man sich doch ein wenig damit beschäftigen muss: SBOMs sind als Plugins realisiert und es gibt Unterschiede:

Das Plugin für die Erzeugung von CycloneDX liefert meiner Ansicht nach die besten Ergebnisse:

<plugin>
   <groupId>org.spdx</groupId>
   <artifactId>spdx-maven-plugin</artifactId>
   <version>1.0.0-RC2</version>
   <executions>
       <execution>
           <id>build-spdx</id>
           <phase>package</phase>
           <goals>
               <goal>createSPDX</goal>
           </goals>
       </execution>
   </executions>

</plugin>

Nicht nur enthält es subjektiv mehr Informationen zu jeder einzelnen Komponente, sondern bildet auch den Dependency Tree für transiente Dependencies ab - etwas, das das Plugin für SPDX nicht schafft:

<plugin>
   <groupId>org.cyclonedx</groupId>
   <artifactId>cyclonedx-maven-plugin</artifactId>
   <version>2.7.1</version>
</plugin>

Warum erzähle ich hier eigentlich aber von Maven wenn doch die Voraussetzung war, dass es um Projekte geht, die Maven nicht als Buildsystem nutzen?

Apache Ant bietet - genau wie Maven - die Möglichkeit, durch Plugins erweitert zu werden. Eines der vielen verfügbaren Plugins erweitert Ant um einen Dependency Manager: Apache Ivy.

Dieser bietet die Möglichkeit, Maven BOMs zu erstellen - und zwar über den Zwischenschritt einer konsolidierten Apache Ivy Dependency Liste.

Mit dieser BOM kann man dann - indem man sie um das gewünschte Plugin erweitert - verschiedene Möglichkeiten nutzen, das Abhängigkeitsgeflecht des Projektes zu visualisieren. Man kann dazu zum Beispiel die Abhängigkeiten statt wie oben dargestellt in Textform als graphml exportieren mittels geeigneter Werkzeuge - wie zum Beispiel yEd weiterverarbeiten.

Alle Artikel rss Wochenübersicht Monatsübersicht Codeberg Repositories Mastodon Über mich home xmpp


Vor 5 Jahren hier im Blog

  • Derangement - theoretische Betrachtungen

    23.12.2020

    Ich habe bereits über meine Implementierung eines Derangement berichtet - hier noch einige theoretische Nachbetrachtungen...

    Weiterlesen

Neueste Artikel

  • Asymmetrische Kryptographie

    Ich habe mich mit der Idee schon länger getragen: Nochmal einen Rundumschlag zu asymmetrischer Kryptographie zu machen. Dabei werde ich mich auf Demonstrationen der einzelnen Konzepte und Operationen mit Beispielcode konzentrieren und zu jedem der vorgestellten Konzepte mehr oder weniger ausführlich bezüglich der Einsatzszenarien und Vor- und Nachteile Stellung beziehen

    Weiterlesen
  • Eingereichter Vortag zum 39C3 - Gentlemen - check your architecture!

    Dieser Vortrag wurde zum 39C3 eingereicht und abgelehnt. Ich möchte einige Open-Source-Frameworks für verschiedene Programmiersprachen vorstellen, mit denen sich Architekturregeln pro Projekt oder Organisation festlegen und mithilfe gängiger Testinfrastrukturen durchsetzen lassen.

    Weiterlesen
  • Chatkontrolle vermeiden ist gleichzeitig unwichtig und nicht genug!

    Das ist ein Abstract eines Vortrages, den ich auf dem 39C3 halten wurde, der aber abgelehnt wurde

    Weiterlesen

Manche nennen es Blog, manche Web-Seite - ich schreibe hier hin und wieder über meine Erlebnisse, Rückschläge und Erleuchtungen bei meinen Hobbies.

Wer daran teilhaben und eventuell sogar davon profitieren möchte, muss damit leben, daß ich hin und wieder kleine Ausflüge in Bereiche mache, die nichts mit IT, Administration oder Softwareentwicklung zu tun haben.

Ich wünsche allen Lesern viel Spaß und hin und wieder einen kleinen AHA!-Effekt...

PS: Meine öffentlichen Codeberg-Repositories findet man hier.