Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Print maven output on Maven error #709

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func getMavenLocalRepoPath(mvnSettingsFile string) string {
}

// check errors
return string(outb.String())
return outb.String()
}

func (p *javaServiceClient) GetDependenciesFallback(ctx context.Context, location string) (map[uri.URI][]*provider.Dep, error) {
Expand Down Expand Up @@ -310,7 +310,7 @@ func (p *javaServiceClient) getDependenciesForMaven(_ context.Context) (map[uri.
cmd.Dir = moddir
mvnOutput, err := cmd.CombinedOutput()
if err != nil {
return nil, err
return nil, fmt.Errorf("maven dependency:tree command failed with error %w, maven output: %s", err, string(mvnOutput))
}

lines := strings.Split(string(mvnOutput), "\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (p *javaProvider) Init(ctx context.Context, log logr.Logger, config provide
mvnOutput, err := cmd.CombinedOutput()
if err != nil {
cancelFunc()
return nil, additionalBuiltinConfig, fmt.Errorf("error downloading java artifact %s - %w", mvnUri, err)
return nil, additionalBuiltinConfig, fmt.Errorf("error downloading java artifact %s - maven output: %s - with error %w", mvnUri, string(mvnOutput), err)
}
downloadedPath := filepath.Join(outputDir,
fmt.Sprintf("%s.jar", strings.Join(mvnCoordinatesParts[1:3], "-")))
Expand Down Expand Up @@ -694,7 +694,7 @@ func resolveSourcesJarsForMaven(ctx context.Context, log logr.Logger, location,
cmd.Dir = location
mvnOutput, err := cmd.CombinedOutput()
if err != nil {
return err
return fmt.Errorf("maven downloadSources command failed with error %w, maven output: %s", err, string(mvnOutput))
}

reader := bytes.NewReader(mvnOutput)
Expand Down
Loading