From 46837cdbde2f674fb29a800e61d0a30df0ca6abb Mon Sep 17 00:00:00 2001 From: Alberto Garcia <45308839+AlbGarciam@users.noreply.github.com> Date: Thu, 16 Nov 2023 14:31:06 +0100 Subject: [PATCH] Update DefaultModelConverter.java to support Zip files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alberto Garcia-Muñoz --- .../maven/DefaultModelConverter.java | 32 ++++++------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/cyclonedx/maven/DefaultModelConverter.java b/src/main/java/org/cyclonedx/maven/DefaultModelConverter.java index ae79e49b..24249b0d 100644 --- a/src/main/java/org/cyclonedx/maven/DefaultModelConverter.java +++ b/src/main/java/org/cyclonedx/maven/DefaultModelConverter.java @@ -172,18 +172,16 @@ public Component convert(Artifact artifact, CycloneDxSchema.Version schemaVersio if (CycloneDxSchema.Version.VERSION_10 != schemaVersion) { component.setBomRef(component.getPurl()); } - if (isDescribedArtifact(artifact)) { - try { - final MavenProject project = getEffectiveMavenProject(artifact); - if (project != null) { - extractComponentMetadata(project, component, schemaVersion, includeLicenseText); - } - } catch (ProjectBuildingException e) { - if (logger.isDebugEnabled()) { - logger.warn("Unable to create Maven project for " + artifact.getId() + " from repository.", e); - } else { - logger.warn("Unable to create Maven project for " + artifact.getId() + " from repository."); - } + try { + final MavenProject project = getEffectiveMavenProject(artifact); + if (project != null) { + extractComponentMetadata(project, component, schemaVersion, includeLicenseText); + } + } catch (ProjectBuildingException e) { + if (logger.isDebugEnabled()) { + logger.warn("Unable to create Maven project for " + artifact.getId() + " from repository.", e); + } else { + logger.warn("Unable to create Maven project for " + artifact.getId() + " from repository."); } } return component; @@ -204,16 +202,6 @@ private boolean isModified(Artifact artifact) { return false; } - /** - * Returns true for any artifact type which will positively have a POM that - * describes the artifact. - * @param artifact the artifact - * @return true if artifact will have a POM, false if not - */ - private boolean isDescribedArtifact(Artifact artifact) { - return artifact.getType().equalsIgnoreCase("jar"); - } - /** * Extracts data from a project and adds the data to the component. * @param project the project to extract data from