diff --git a/src/main/java/org/cyclonedx/maven/BaseCycloneDxMojo.java b/src/main/java/org/cyclonedx/maven/BaseCycloneDxMojo.java index a8f386d3..19413bd9 100644 --- a/src/main/java/org/cyclonedx/maven/BaseCycloneDxMojo.java +++ b/src/main/java/org/cyclonedx/maven/BaseCycloneDxMojo.java @@ -435,7 +435,7 @@ protected Component convert(Artifact artifact) { final Component component = new Component(); component.setGroup(artifact.getGroupId()); component.setName(artifact.getArtifactId()); - component.setVersion(artifact.getVersion()); + component.setVersion(artifact.getBaseVersion()); component.setType(Component.Type.LIBRARY); try { getLog().debug(MESSAGE_CALCULATING_HASHES); @@ -470,7 +470,7 @@ private String generatePackageUrl(final Artifact artifact) { qualifiers.put("classifier", artifact.getClassifier()); } } - return generatePackageUrl(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), qualifiers, null); + return generatePackageUrl(artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(), qualifiers, null); } private String generatePackageUrl(String groupId, String artifactId, String version, TreeMap qualifiers, String subpath) { @@ -726,10 +726,10 @@ private MavenProject readPom(File file) throws IOException { private MavenProject readPom(InputStream in) { try { final MavenXpp3Reader mavenreader = new MavenXpp3Reader(); - try (final InputStreamReader reader = new InputStreamReader(new BOMInputStream(in))) { + try (final InputStreamReader reader = new InputStreamReader(new BOMInputStream(in))) { final Model model = mavenreader.read(reader); return new MavenProject(model); - } + } //if you don't like BOMInputStream you can also escape the error this way: // catch (XmlPullParserException xppe){ // if (! xppe.getMessage().startsWith("only whitespace content allowed before start tag")){