@@ -41,7 +41,7 @@ func mavenBuild(config mavenBuildOptions, telemetryData *telemetry.CustomData, c
41
41
}
42
42
43
43
func runMakeBOMGoal (config * mavenBuildOptions , utils maven.Utils ) error {
44
- var flags = []string {"-update-snapshots" , "--batch-mode" }
44
+ flags : = []string {"-update-snapshots" , "--batch-mode" }
45
45
if len (config .Profiles ) > 0 {
46
46
flags = append (flags , "--activate-profiles" , strings .Join (config .Profiles , "," ))
47
47
}
@@ -89,8 +89,7 @@ func runMakeBOMGoal(config *mavenBuildOptions, utils maven.Utils) error {
89
89
}
90
90
91
91
func runMavenBuild (config * mavenBuildOptions , _ * telemetry.CustomData , utils maven.Utils , commonPipelineEnvironment * mavenBuildCommonPipelineEnvironment ) error {
92
-
93
- var flags = []string {"-update-snapshots" , "--batch-mode" }
92
+ flags := []string {"-update-snapshots" , "--batch-mode" }
94
93
95
94
if len (config .Profiles ) > 0 {
96
95
flags = append (flags , "--activate-profiles" , strings .Join (config .Profiles , "," ))
@@ -255,7 +254,7 @@ func createBuildArtifactsMetadata(config *mavenBuildOptions, commonPipelineEnvir
255
254
} else {
256
255
coordinate .BuildPath = filepath .Dir (match )
257
256
coordinate .URL = config .AltDeploymentRepositoryURL
258
- coordinate .PURL = getPurlForThePom ( match )
257
+ coordinate .PURL = piperutils . GetPurl ( filepath . Join ( filepath . Dir ( match ), "/target/" + mvnSimpleBomFilename + ".xml" ) )
259
258
buildCoordinates = append (buildCoordinates , coordinate )
260
259
}
261
260
}
@@ -274,25 +273,6 @@ func createBuildArtifactsMetadata(config *mavenBuildOptions, commonPipelineEnvir
274
273
return nil , false
275
274
}
276
275
277
- func getPurlForThePom (pomFilePath string ) string {
278
- bomPath := filepath .Join (filepath .Dir (pomFilePath ) + "/target/" + mvnSimpleBomFilename + ".xml" )
279
- exists , _ := piperutils .FileExists (bomPath )
280
- if ! exists {
281
- log .Entry ().Debugf ("bom file doesn't exist and hence no pURL info: %v" , bomPath )
282
- return ""
283
- }
284
- bom , err := piperutils .GetBom (bomPath )
285
- if err != nil {
286
- log .Entry ().Warnf ("failed to get bom file %s: %v" , bomPath , err )
287
- return ""
288
- }
289
-
290
- log .Entry ().Debugf ("Found purl: %s for the bomPath: %s" , bom .Metadata .Component .Purl , bomPath )
291
- purl := bom .Metadata .Component .Purl
292
-
293
- return purl
294
- }
295
-
296
276
func createOrUpdateProjectSettingsXML (projectSettingsFile string , altDeploymentRepositoryID string , altDeploymentRepositoryUser string , altDeploymentRepositoryPassword string , utils maven.Utils ) (string , error ) {
297
277
if len (projectSettingsFile ) > 0 {
298
278
projectSettingsFilePath , err := maven .UpdateProjectSettingsXML (projectSettingsFile , altDeploymentRepositoryID , altDeploymentRepositoryUser , altDeploymentRepositoryPassword , utils )
@@ -310,15 +290,14 @@ func createOrUpdateProjectSettingsXML(projectSettingsFile string, altDeploymentR
310
290
}
311
291
312
292
func loadRemoteRepoCertificates (certificateList []string , client piperhttp.Downloader , flags * []string , runner command.ExecRunner , fileUtils piperutils.FileUtils , javaCaCertFilePath string ) error {
313
- //TODO: make use of java/keytool package
293
+ // TODO: make use of java/keytool package
314
294
existingJavaCaCerts := filepath .Join (os .Getenv ("JAVA_HOME" ), "jre" , "lib" , "security" , "cacerts" )
315
295
316
296
if len (javaCaCertFilePath ) > 0 {
317
297
existingJavaCaCerts = javaCaCertFilePath
318
298
}
319
299
320
300
exists , err := fileUtils .FileExists (existingJavaCaCerts )
321
-
322
301
if err != nil {
323
302
return errors .Wrap (err , "Could not find the existing java cacerts" )
324
303
}
0 commit comments