@@ -43,19 +43,26 @@ else {
4343 exit 1
4444}
4545
46- # Process packages with appropriate groupId
4746if (! [String ]::IsNullOrWhiteSpace($ArtifactsJson )) {
48- # When using ArtifactsJson, process each artifact with its specific groupId
47+ # When using ArtifactsJson, process each artifact with its name and groupId (if applicable)
4948 try {
5049 $artifacts = $ArtifactsJson | ConvertFrom-Json
5150 foreach ($artifact in $artifacts ) {
52- $packageName = $artifact.name
53- $groupId = $artifact.groupId
54-
55- Write-Host " Processing $packageName with groupId $groupId "
51+ $packageName = $artifact.name
5652 $newVersion = [AzureEngSemanticVersion ]::new(" 1.0.0" )
57- # Use groupId+artifactName format for tag prefix (e.g., "com.azure.v2+azure-sdk-template_")
58- $prefix = " $groupId +$packageName$TagSeparator "
53+ $prefix = " $packageName$TagSeparator "
54+
55+ if ($Language -eq " java" ) {
56+ $groupId = $artifact.groupId
57+ Write-Host " Processing $packageName with groupId $groupId "
58+ if ([String ]::IsNullOrWhiteSpace($groupId )) {
59+ LogError " GroupId is missing for package $packageName ."
60+ exit 1
61+ }
62+ # Use groupId+artifactName format for tag prefix (e.g., "com.azure.v2+azure-sdk-template_")
63+ $prefix = " $groupId +$packageName$TagSeparator "
64+ }
65+
5966 Write-Host " Get Latest Tag : git tag -l $prefix *"
6067 $latestTags = git tag - l " $prefix *"
6168
@@ -77,23 +84,28 @@ if (![String]::IsNullOrWhiteSpace($ArtifactsJson)) {
7784
7885 Write-Host " Version to publish [ $ ( $newVersion.ToString ()) ]"
7986
80- SetPackageVersion - PackageName $packageName `
81- - Version $newVersion.ToString () `
82- - ServiceDirectory $ServiceDirectory `
83- - GroupId $groupId
87+ if ($Language -ne " java" ) {
88+ SetPackageVersion - PackageName $packageName `
89+ - Version $newVersion.ToString () `
90+ - ServiceDirectory $ServiceDirectory
91+ } else {
92+ SetPackageVersion - PackageName $packageName `
93+ - Version $newVersion.ToString () `
94+ - ServiceDirectory $ServiceDirectory `
95+ - GroupId $groupId
96+ }
8497 }
8598 }
8699 catch {
87- LogError " Failed to process ArtifactsJson: $ ( $_.Exception.Message ) "
100+ LogError " Failed to process ArtifactsJson: $ArtifactsJson , exception: $ ( $_.Exception.Message ) "
88101 exit 1
89102 }
90103} else {
91104 # Fallback to original logic when using PackageNames string
92105 foreach ($packageName in $packageNamesArray ) {
93106 Write-Host " Processing $packageName "
94107 $newVersion = [AzureEngSemanticVersion ]::new(" 1.0.0" )
95- # For legacy PackageNames, assume com.azure groupId for backward compatibility
96- $prefix = " com.azure+$packageName$TagSeparator "
108+ $prefix = " $packageName$TagSeparator "
97109 Write-Host " Get Latest Tag : git tag -l $prefix *"
98110 $latestTags = git tag - l " $prefix *"
99111
0 commit comments