Skip to content

Commit

Permalink
Fix potential NPE in Maven publication
Browse files Browse the repository at this point in the history
A Maven publication does not always have a main artifact.

Issue jfrog#247
  • Loading branch information
ljacomet committed Oct 16, 2019
1 parent 04e8afd commit 5e5b187
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,10 @@ public Set<GradleDeployDetails> getArtifactDeployDetails() {
addMavenArtifactToDeployDetails(deployDetails, publicationName, builder, artifactInfo, mavenPublication);
}
}
// Second adding the main artifact of the publication
createPublishArtifactInfoAndAddToDeployDetails(mavenNormalizedPublication.getMainArtifact(), deployDetails, mavenPublication, publicationName);
// Second adding the main artifact of the publication, if present
if (mavenNormalizedPublication.getMainArtifact() != null) {
createPublishArtifactInfoAndAddToDeployDetails(mavenNormalizedPublication.getMainArtifact(), deployDetails, mavenPublication, publicationName);
}

// Third adding all additional artifacts - includes Gradle Module Metadata when produced
Set<MavenArtifact> artifacts = mavenNormalizedPublication.getAdditionalArtifacts();
Expand Down

0 comments on commit 5e5b187

Please sign in to comment.