From dfa122beb2ea50f34953754ac44650036a9c26e2 Mon Sep 17 00:00:00 2001 From: Steve Springett Date: Thu, 1 Apr 2021 00:16:38 -0500 Subject: [PATCH] Bumped CycloneDX Core Java and changes necessary to support it. Updated dependencies and description. --- build.gradle | 11 ++++------- pom.xml | 13 ++++++++++--- .../java/org/cyclonedx/gradle/CycloneDxTask.java | 6 +++--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 65f1cd3..83a0dfc 100644 --- a/build.gradle +++ b/build.gradle @@ -8,13 +8,10 @@ plugins { repositories { jcenter() mavenCentral() - maven { - url 'https://jitpack.io' - } } dependencies { - compile(group: 'org.cyclonedx', name: 'cyclonedx-core-java', version: '3.0.5') { + compile(group: 'org.cyclonedx', name: 'cyclonedx-core-java', version: '4.1.0') { // gradle-api already includes an slf4j binding exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl' } @@ -24,7 +21,7 @@ dependencies { } group = 'com.cyclonedx' -version = '1.2.1' +version = '1.2.2-SNAPSHOT' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -36,11 +33,11 @@ tasks.withType(JavaCompile) { pluginBundle { website = 'http://cyclonedx.org' vcsUrl = 'https://github.com/CycloneDX/cyclonedx-gradle-plugin.git' - tags = [ 'cyclonedx', 'dependency', 'dependencies', 'owasp', 'bom' ] + tags = [ 'cyclonedx', 'dependency', 'dependencies', 'owasp', 'inventory', 'bom', 'sbom' ] plugins { cycloneDxPlugin { displayName = 'CycloneDX BOM Generator' - description = 'The CycloneDX Gradle plugin creates an aggregate of all direct and transitive dependencies of a project and creates a valid CycloneDX bill-of-materials document from the results. CycloneDX is a lightweight BOM specification that is easily created, human readable, and simple to parse.' + description = 'The CycloneDX Gradle plugin creates an aggregate of all direct and transitive dependencies of a project and creates a valid CycloneDX Software Bill of Materials (SBOM).' } } } diff --git a/pom.xml b/pom.xml index 31125ef..8a97413 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ 1.2.2-SNAPSHOT CycloneDX Gradle Plugin - The CycloneDX Gradle plugin creates an aggregate of all direct and transitive dependencies of a project and creates a valid CycloneDX bill-of-materials document from the results. CycloneDX is a lightweight BOM specification that is easily created, human readable, and simple to parse. + The CycloneDX Gradle plugin creates an aggregate of all direct and transitive dependencies of a project and creates a valid CycloneDX Software Bill of Materials (SBOM). https://github.com/CycloneDX/cyclonedx-gradle-plugin 2017 @@ -67,7 +67,7 @@ 3.1.1 3.2.1 3.0.2 - 2.0.3 + 2.4.0 1.4.0 @@ -103,7 +103,14 @@ org.cyclonedx cyclonedx-core-java - 3.0.5 + 4.1.0 + + + + commons-codec + commons-codec + 1.15 commons-codec diff --git a/src/main/java/org/cyclonedx/gradle/CycloneDxTask.java b/src/main/java/org/cyclonedx/gradle/CycloneDxTask.java index f15c42a..62b7904 100644 --- a/src/main/java/org/cyclonedx/gradle/CycloneDxTask.java +++ b/src/main/java/org/cyclonedx/gradle/CycloneDxTask.java @@ -24,6 +24,7 @@ import org.apache.maven.project.MavenProject; import org.cyclonedx.BomGeneratorFactory; import org.cyclonedx.CycloneDxSchema; +import org.cyclonedx.exception.GeneratorException; import org.cyclonedx.generators.json.BomJsonGenerator; import org.cyclonedx.generators.xml.BomXmlGenerator; import org.cyclonedx.model.Bom; @@ -364,13 +365,13 @@ protected void writeBom(Metadata metadata, Set components) throws Gra if (schemaVersion().getVersion() >= 1.2) { writeJSONBom(schemaVersion, bom); } - } catch (ParserConfigurationException | TransformerException | IOException e) { + } catch (GeneratorException | ParserConfigurationException | TransformerException | IOException e) { throw new GradleException("An error occurred executing " + this.getClass().getName(), e); } } private void writeXMLBom(final CycloneDxSchema.Version schemaVersion, final Bom bom) - throws ParserConfigurationException, TransformerException, IOException { + throws GeneratorException, ParserConfigurationException, TransformerException, IOException { final BomXmlGenerator bomGenerator = BomGeneratorFactory.createXml(schemaVersion, bom); bomGenerator.generate(); final String bomString = bomGenerator.toXmlString(); @@ -391,7 +392,6 @@ private void writeXMLBom(final CycloneDxSchema.Version schemaVersion, final Bom private void writeJSONBom(final CycloneDxSchema.Version schemaVersion, final Bom bom) throws IOException { final BomJsonGenerator bomGenerator = BomGeneratorFactory.createJson(schemaVersion, bom); - bomGenerator.generate(); final String bomString = bomGenerator.toJsonString(); final File bomFile = new File(buildDir, "reports/bom.json"); getLogger().info(MESSAGE_WRITING_BOM_JSON);