@@ -109,9 +109,9 @@ import-module "Microsoft.TeamFoundation.DistributedTask.Task.TestResults"
109109
110110
111111$buildRootPath = Split-Path $mavenPOMFile - Parent
112- $reportDirectoryName = [ guid ]::NewGuid()
112+ $reportDirectoryName = " ReportDirectoryC91CDE2D "
113113$reportDirectoryNameCobertura = " target\site\cobertura"
114- $reportPOMFileName = [ guid ]::NewGuid().tostring() + " .xml"
114+ $reportPOMFileName = " ReportPOMFile4E52C1C4 .xml"
115115$reportPOMFile = Join-Path $buildRootPath $reportPOMFileName
116116$reportDirectory = Join-Path $buildRootPath $reportDirectoryName
117117$reportDirectoryCobertura = Join-Path $buildRootPath $reportDirectoryNameCobertura
@@ -126,6 +126,38 @@ $CCReportTask = "jacoco:report"
126126
127127Write-Verbose " SummaryFileCobertura = $summaryFileCobertura "
128128
129+ try
130+ {
131+ if (Test-Path $reportDirectory )
132+ {
133+ # delete any previous code coverage data
134+ rm - r $reportDirectory - force | Out-Null
135+ }
136+
137+ if (Test-Path $reportDirectoryCobertura )
138+ {
139+ # delete any previous code coverage data from Cobertura
140+ rm - r $reportDirectoryCobertura - force | Out-Null
141+ }
142+ }
143+ catch
144+ {
145+ Write-Verbose " Failed to delete report directory"
146+ }
147+
148+ try
149+ {
150+ if (Test-Path $reportPOMFile )
151+ {
152+ # delete any previous code coverage data
153+ rm $reportPOMFile - force | Out-Null
154+ }
155+ }
156+ catch
157+ {
158+ Write-Verbose " Failed to delete report POM file"
159+ }
160+
129161if ($isCoverageEnabled )
130162{
131163 if (Test-Path $targetDirectory )
@@ -184,26 +216,4 @@ ElseIf ($codeCoverageTool -eq "Cobertura")
184216# Run SonarQube analysis by invoking Maven with the "sonar:sonar" goal
185217RunSonarQubeAnalysis $sqAnalysisEnabled $sqConnectedServiceName $sqDbDetailsRequired $sqDbUrl $sqDbUsername $sqDbPassword $options $mavenPOMFile $execFileJacoco
186218
187- if (Test-Path $reportDirectory )
188- {
189- # delete any previous code coverage data
190- rm - r $reportDirectory - force | Out-Null
191- }
192-
193- if (Test-Path $reportDirectoryCobertura )
194- {
195- # delete any previous code coverage data from Cobertura
196- rm - r $reportDirectoryCobertura - force | Out-Null
197- }
198-
199- if (Test-Path $reportPOMFile )
200- {
201- # delete any previous code coverage data
202- rm $reportPOMFile - force | Out-Null
203- }
204-
205219Write-Verbose " Leaving script Maven.ps1"
206-
207-
208-
209-
0 commit comments