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 }