Skip to content

Commit

Permalink
Add POM parent element fallback for GroupId and Version (Azure#24872)
Browse files Browse the repository at this point in the history
  • Loading branch information
hallipr authored Oct 19, 2021
1 parent e7f3ce8 commit 28f7956
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions eng/scripts/MavenPackaging.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,17 @@ function Get-MavenPackageDetails([string]$ArtifactDirectory) {
[xml]$pomDocument = Get-Content $pomFile

$packageDetail.GroupID = $pomDocument.project.groupId
if (!$packageDetail.GroupID) { $packageDetail.GroupID = $pomDocument.project.parent.groupId }
if (!$packageDetail.GroupID) { throw "No GroupID found for $pomFile" }
Write-Information "Group ID is: $($packageDetail.GroupID)"

$packageDetail.ArtifactID = $pomDocument.project.artifactId
if (!$packageDetail.ArtifactID) { throw "No ArtifactID found for $pomFile" }
Write-Information "Artifact ID is: $($packageDetail.ArtifactID)"

$packageDetail.Version = $pomDocument.project.version
if (!$packageDetail.Version) { $packageDetail.Version = $pomDocument.project.parent.version }
if (!$packageDetail.Version) { throw "No Version found for $pomFile" }
Write-Information "Version is: $($packageDetail.Version)"

$packageDetail.IsSnapshot = $packageDetail.Version.EndsWith("-SNAPSHOT")
Expand Down

0 comments on commit 28f7956

Please sign in to comment.