Skip to content

Commit

Permalink
Merge pull request #175 from ThomGeG/version-parsing-updates
Browse files Browse the repository at this point in the history
Utilize base-version instead of version
  • Loading branch information
stevespringett authored Apr 24, 2022
2 parents d8cc991 + fb8f589 commit 8446b87
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/org/cyclonedx/maven/BaseCycloneDxMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<String, String> qualifiers, String subpath) {
Expand Down Expand Up @@ -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")){
Expand Down

0 comments on commit 8446b87

Please sign in to comment.