Skip to content

Commit ee9c39b

Browse files
committed
Implement and document SBOM (#1707)
1 parent 99da49f commit ee9c39b

File tree

3 files changed

+40
-15
lines changed

3 files changed

+40
-15
lines changed

pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,26 @@
524524

525525
<plugins>
526526

527+
<!-- `cyclonedx-maven-plugin` doesn't exclude not installed/deployed modules: https://github.com/CycloneDX/cyclonedx-maven-plugin/issues/409
528+
This `generate-sbom` execution override configures such exclusions. -->
529+
<plugin>
530+
<groupId>org.cyclonedx</groupId>
531+
<artifactId>cyclonedx-maven-plugin</artifactId>
532+
<executions>
533+
<execution>
534+
<id>generate-sbom</id>
535+
<configuration combine.self="append">
536+
<excludeArtifactId>log4j-api-java9</excludeArtifactId>
537+
<excludeArtifactId>log4j-core-its</excludeArtifactId>
538+
<excludeArtifactId>log4j-core-java9</excludeArtifactId>
539+
<excludeArtifactId>log4j-layout-template-json-test</excludeArtifactId>
540+
<excludeArtifactId>log4j-osgi-test</excludeArtifactId>
541+
<excludeArtifactId>log4j-perf-test</excludeArtifactId>
542+
</configuration>
543+
</execution>
544+
</executions>
545+
</plugin>
546+
527547
<!-- Enable BOM flattening -->
528548
<plugin>
529549
<groupId>org.codehaus.mojo</groupId>

src/site/markdown/maven-artifacts.md.vm

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,14 @@ To build with [SBT](http://www.scala-sbt.org/), add the dependencies listed belo
123123

124124
#sbt(['log4j-api', 'log4j-core'])
125125

126-
$h2 Bill of Material
126+
$h2 Maven Bill of Materials (BOM)
127127

128-
To keep your Log4j module versions in sync with each other, a
129-
<abbr id="Bill of Material">BOM</abbr>
130-
pom.xml file is provided for your convenience. To use this with
131-
[Maven](https://maven.apache.org/), add the dependency listed below to your
132-
`pom.xml`
133-
file. When you specify the version identifier in this section, you don't have to specify the version in your
134-
`<dependencies/>` section.
128+
To keep your Log4j module versions aligned, a [Maven Bill of Materials (BOM) POM](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms) is provided for your convenience.
129+
130+
To use this with Maven, add the dependency listed below to your `pom.xml` file.
131+
Note that the `<dependencyManagement>` nesting and the `<scope>import</scope>` instruction.
132+
This will *import* all modules bundled with the associated Log4j release to your `dependencyManagement`.
133+
As a result, you don't have to specify versions of the imported modules (`log4j-api`, `log4j-core`, etc.) while adding them using `<dependency>` elements.
135134

136135
`pom.xml`
137136

@@ -188,6 +187,11 @@ dependencies {
188187
}
189188
```
190189

190+
$h2 CycloneDX Software Bill of Materials (SBOM)
191+
192+
Starting with version `2.22.0`, Log4j distributes [CyclenoDX Software Bill of Materials (SBOM)](https://cyclonedx.org/capabilities/sbom/) along with each deployed artifact.
193+
This is streamlined by `logging-parent`, see https://logging.apache.org/logging-parent/latest/#cyclonedx-sbom[its website] for details.
194+
191195
$h2 Optional Components
192196

193197
Log4j 2.x contains several optional components that can be included in an application.

src/site/site.xml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@
4646
<item name="Download" href="/download.html"/>
4747
<item name="Support" href="/support.html"/>
4848
<item name="Maven, Ivy, Gradle Artifacts" href="/maven-artifacts.html" collapse="true">
49-
<item name="Maven" href="/maven-artifacts.html#Using_Log4j_in_your_Apache_Maven_build" />
50-
<item name="Ivy" href="/maven-artifacts.html#Using_Log4j_in_your_Apache_Ivy_build" />
51-
<item name="Gradle" href="/maven-artifacts.html#Using_Log4j_in_your_Gradle_build" />
52-
<item name="SBT" href="/maven-artifacts.html#Using_Log4j_in_your_SBT_build" />
53-
<item name="Bill of Material" href="/maven-artifacts.html#Bill_of_Material" />
54-
<item name="Optional Components" href="/maven-artifacts.html#Optional_Components" />
55-
<item name="Snapshot builds" href="/maven-artifacts.html#Snapshot_builds" />
49+
<item name="Maven" href="/maven-artifacts.html#using-log4j-in-your-apache-maven-build" />
50+
<item name="Ivy" href="/maven-artifacts.html#using-log4j-in-your-apache-ivy-build" />
51+
<item name="Gradle" href="/maven-artifacts.html#using-log4j-in-your-gradle-build" />
52+
<item name="SBT" href="/maven-artifacts.html#using-log4j-in-your-sbt-build" />
53+
<item name="Maven Bill of Materials (BOM)" href="/maven-artifacts.html#maven-bill-of-materials-bom" />
54+
<item name="CycloneDX Software Bill of Materials (SBOM)" href="/maven-artifacts.html#cyclonedx-software-bill-of-materials-sbom" />
55+
<item name="Optional Components" href="/maven-artifacts.html#optional-components" />
56+
<item name="Snapshot builds" href="/maven-artifacts.html#snapshot-builds" />
5657
</item>
5758
<item name="Release Notes" href="/release-notes.html"/>
5859
<item name="FAQ" href="/faq.html"/>

0 commit comments

Comments
 (0)