From 38a2c49a0d755d0d286ed53aced495453d20f37d Mon Sep 17 00:00:00 2001 From: Omer Zidkoni <50792403+omerzi@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:34:09 +0300 Subject: [PATCH] Get generated build info path for maven modules (#263) --- build/maven.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/build/maven.go b/build/maven.go index 8a24af97..5c9c890c 100644 --- a/build/maven.go +++ b/build/maven.go @@ -43,6 +43,8 @@ type MavenModule struct { extractorDetails *extractorDetails // A pipe to write the maven extractor output to. outputWriter io.Writer + // Path to the build info temp file that will be generated by the maven extractor. + buildInfoPath string } // Maven extractor is the engine for calculating the project dependencies. @@ -111,6 +113,12 @@ func (mm *MavenModule) SetMavenOpts(mavenOpts ...string) { mm.extractorDetails.mavenOpts = mavenOpts } +// Returns the path to the build info generated by the maven extractor. +// This file is a tempfile that can be consumed to generated a build info object. +func (mm *MavenModule) GetGeneratedBuildInfoPath() string { + return mm.buildInfoPath +} + func (mm *MavenModule) createMvnRunConfig() (*mvnRunConfig, error) { var javaExecPath string mavenHome, err := mm.loadMavenHome() @@ -133,11 +141,11 @@ func (mm *MavenModule) createMvnRunConfig() (*mvnRunConfig, error) { if len(plexusClassworlds) != 1 { return nil, errors.New("couldn't find plexus-classworlds-x.x.x.jar in Maven installation path, please check M2_HOME environment variable") } - buildInfoPath, err := createEmptyBuildInfoFile(mm.containingBuild) + mm.buildInfoPath, err = createEmptyBuildInfoFile(mm.containingBuild) if err != nil { return nil, err } - extractorProps, err := utils.CreateExtractorPropsFile(mm.extractorDetails.propsDir, buildInfoPath, mm.containingBuild.buildName, mm.containingBuild.buildNumber, mm.containingBuild.buildTimestamp, mm.containingBuild.projectKey, mm.extractorDetails.props) + extractorProps, err := utils.CreateExtractorPropsFile(mm.extractorDetails.propsDir, mm.buildInfoPath, mm.containingBuild.buildName, mm.containingBuild.buildNumber, mm.containingBuild.buildTimestamp, mm.containingBuild.projectKey, mm.extractorDetails.props) if err != nil { return nil, err }