Skip to content

Commit

Permalink
Log full Maven output on errors
Browse files Browse the repository at this point in the history
Java provider uses mvn command to fetch java binary or its dependencies.
There was a check for success/error of those commands, but to identify a
root cause and fix the mvn problem, its full output is required.

The maven output can be be exhaustive, but it is logged only in case of
its failure.

Signed-off-by: Marek Aufart <[email protected]>
  • Loading branch information
aufi committed Oct 24, 2024
1 parent e308a56 commit f7cb86a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ func (p *javaServiceClient) getDependenciesForMaven(_ context.Context) (map[uri.
cmd.Dir = moddir
mvnOutput, err := cmd.CombinedOutput()
if err != nil {
p.log.Error(err, string(mvnOutput))
return nil, err
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ func (p *javaProvider) Init(ctx context.Context, log logr.Logger, config provide
mvnOutput, err := cmd.CombinedOutput()
if err != nil {
cancelFunc()
p.Log.Error(err, string(mvnOutput))
return nil, additionalBuiltinConfig, fmt.Errorf("error downloading java artifact %s - %w", mvnUri, err)
}
downloadedPath := filepath.Join(outputDir,
Expand Down Expand Up @@ -694,6 +695,7 @@ func resolveSourcesJarsForMaven(ctx context.Context, log logr.Logger, location,
cmd.Dir = location
mvnOutput, err := cmd.CombinedOutput()
if err != nil {
log.Error(err, string(mvnOutput))
return err
}

Expand Down

0 comments on commit f7cb86a

Please sign in to comment.