From f6d597588d99150a2d0b61da156419086f2052fe Mon Sep 17 00:00:00 2001 From: Juan Manuel Leflet Estrada Date: Wed, 25 Oct 2023 23:14:05 +0200 Subject: [PATCH] Filter artifacts if they are submodules of the project Signed-off-by: Juan Manuel Leflet Estrada --- provider/internal/java/provider.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/provider/internal/java/provider.go b/provider/internal/java/provider.go index 6c2212fd..4af014ba 100644 --- a/provider/internal/java/provider.go +++ b/provider/internal/java/provider.go @@ -364,6 +364,10 @@ func resolveSourcesJars(ctx context.Context, log logr.Logger, location, mavenSet if err != nil { return err } + + // remove unresolved sources if they are an actual module in the project + artifacts = filterExistingSubmodules(artifacts, pom) + m2Repo := getMavenLocalRepoPath(mavenSettings) if m2Repo == "" { return nil @@ -396,7 +400,7 @@ func resolveSourcesJars(ctx context.Context, log logr.Logger, location, mavenSet return nil } -// filterExistingSubmodules takes a list of artifacts and takes out the ones existing in a pom's modules list +// filterExistingSubmodules takes a list of artifacts and removes the ones existing in the given pom's modules list func filterExistingSubmodules(artifacts []javaArtifact, pom *gopom.Project) []javaArtifact { if pom.Modules == nil { return artifacts