# Tooling Ecosystem for CycloneDX
This page introduces a selection of tools that can help **generate** SBOMs across different programming languages and ecosystems. While not exhaustive, it aims to offer a starting point for creating SBOMs in the CycloneDX format.
| **Environment** | **Ecosystem/Build System** | **Tool** |
|---------------------|----------------------------|---------------------------------------------------------------|
| **Java** | Maven | [cyclonedx-for-maven](#cyclonedx-for-maven) |
| | Gradle | [cyclonedx-for-gradle](#cyclonedx-for-gradle) |
| **Python** | All | [cyclonedx-for-python](#cyclonedx-for-python) |
| | Github Actions | [gh-python-generate-sbom](#gh-python-generate-sbom)|
| **Nodejs** | All | [cyclonedx-bom](#cyclonedx-bom) |
| | NPM | [cyclonedx-npm](#cyclonedx-npm) |
| | Yarn | [yarn-plugin-cyclonedx](#yarn-plugin-cyclonedx) |
| | React | [webpack-plugin with React](#webpack-plugin-with-react) |
| | Github Actions | [gh-node-module-generatebom](#gh-node-module-generatebom) |
| **Go** | Modules | [cyclonedx-gomod](#cyclonedx-gomod) |
| **Multi-Ecosystem** | All | [cdxgen](#cdxgen) |
| | Github Actions | [cdxgen-action](#cdxgen-action) |
---
## Java
Java is a compiled language, meaning an SBOM should be generated whenever a release version of the project is built. Since Java build systems are responsible for downloading all the dependencies required to compile and package the project, the optimal choice is to generate an SBOM during the build process.
## Maven
### CycloneDX for Maven
* Website: https://cyclonedx.github.io/cyclonedx-maven-plugin/
* Source: https://github.com/CycloneDX/cyclonedx-maven-plugin
* Supported data sources: `pom.xml` files
### Usage
CycloneDX plugin is available on Maven central. To start using it, add the following plugin into the `pom.xml` file:
```
org.cyclonedxcyclonedx-maven-plugin2.7.0
```
To generate the SBOM, select the suitable `goal` and use the ```mvn cyclonedx:``` command. More details on goals can be found below.
### Integration
By integrating a plugin into the Maven setup, projects can automatically generate SBOMs for each release, as part of the CI pipeline. The plugin supports 3 different methods of generating the record (goals):
* [makeBom](https://cyclonedx.github.io/cyclonedx-maven-plugin/makeBom-mojo.html)
* [makeAggregateBom](https://cyclonedx.github.io/cyclonedx-maven-plugin/makeAggregateBom-mojo.html)
* [makePackageBom](https://cyclonedx.github.io/cyclonedx-maven-plugin/makePackageBom-mojo.html)
More details in can be found in the [official documentation](https://cyclonedx.github.io/cyclonedx-maven-plugin/index.html#goals).
```
org.cyclonedxcyclonedx-maven-pluginpackagemakeAggregateBom
```
### Configuration
The CycloneDX Maven Plugin offers several configuration options that allow customization of how the SBOM is generated for the project, such as: tool version, output format, output location, whether to include license text, whether to include specific dependencies, whether attach it to the build artifacts.
Below is an example of the **default** configuration:
```
org.cyclonedxcyclonedx-maven-pluginlibrary1.6truetruetruetruetruefalsefalsetrueallbom${project.build.directory}false
```
### Additional Reading
* [Snyk Blog: How to create SBOMs in Java with Maven and Gradle](https://snyk.io/blog/create-sboms-java-maven-gradle/)
* [Learn SBOM: Tool Review: CycloneDX Maven](https://www.youtube.com/watch?v=YK9mHhegQV4)
## Gradle
### CycloneDX for Gradle
* Website: https://plugins.gradle.org/plugin/org.cyclonedx.bom
* Source: https://github.com/CycloneDX/cyclonedx-gradle-plugin
* Supported data sources: `build.gradle` or `build.gradle.kts` file
### Usage
To start using it, add the following plugin into the `build.gradle` file:
```
plugins {
id("org.cyclonedx.bom") version "1.10.0"
}
```
To generate the SBOM, run the `gradle cyclonedxBom` command.
### Integration
In Gradle, SBOM generation with the CycloneDX plugin requires a manual setup within CI, as it doesn’t automatically align with predefined build phases like Maven does. The details depend on project specifics, but in broad terms, in order to integrate, invoking the cyclonedxBom task directly in the CI pipeline after successful builds is necessary. This ensures an SBOM is generated with each stable release.
As opposed to Maven's `goals`, Gradle relies on the single `cyclonedxBom` task, meaning it appears to be generating a single SBOM for the project, instead of one per artifact. For publishing, it requires some additional configuration, see [issue link](https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/388).
### Configuration
The CycloneDX Gradle Plugin offers several configuration options that allow customization of how the SBOM is generated for the project. More details about each configuration option can be found in the plugin [README](https://github.com/CycloneDX/cyclonedx-gradle-plugin).
Below is an example of the a configuration. To customise the configuration for your project, simply append it to the `gradle` file.
```
cyclonedxBom {
includeConfigs = ["runtimeClasspath"]
skipConfigs = ["compileClasspath", "testCompileClasspath"]
skipProjects = [rootProject.name, "yourTestSubProject"]
projectType = "application"
schemaVersion = "1.6"
destination = file("build/reports")
outputName = "bom"
outputFormat = "json"
includeBomSerialNumber = false
includeLicenseText = false
includeMetadataResolution = true
componentVersion = "2.0.0"
componentName = "my-component"
}
```
## Python
### CycloneDX for Python
* Website: https://pypi.org/project/cyclonedx-bom/
* Source: https://github.com/CycloneDX/cyclonedx-python
* Requirements: Python ```>=3.8,<4```
### Supported data sources
* Python (virtual) environment
* Poetry manifest and lockfile
* Pipenv manifest and lockfile
* Pip's `requirements.txt` format
* PDM's Python virtual environments
* conda's Python environments
### Installation
* Install via pip: `python -m pip install cyclonedx-bom`
* Install via pipx: `pipx install cyclonedx-bom`
* Install via poetry: `poetry add cyclonedx-bom`
### Usage
* Call script: `cyclonedx-py