Skip to content

Commit

Permalink
Update DefaultModelConverter.java to support Zip files
Browse files Browse the repository at this point in the history
Signed-off-by: Alberto Garcia-Muñoz <alberto.garciamunoz@gruposantander.com>
  • Loading branch information
AlbGarciam authored and hboutemy committed Jan 16, 2024
1 parent dc90b21 commit 46837cd
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions src/main/java/org/cyclonedx/maven/DefaultModelConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 46837cd

Please sign in to comment.