Skip to content

Commit

Permalink
Get generated build info path for maven modules (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
omerzi authored Jul 29, 2024
1 parent 5b51bf7 commit 38a2c49
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions build/maven.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()
Expand All @@ -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
}
Expand Down

0 comments on commit 38a2c49

Please sign in to comment.