Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize base-version instead of version #175

Merged
merged 1 commit into from
Apr 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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