From 4b401e7b23c27533a90fc6598871bb96b56c0c9d Mon Sep 17 00:00:00 2001 From: Pranav Gaikwad Date: Mon, 11 Mar 2024 09:17:55 -0400 Subject: [PATCH] :ghost: refactor Signed-off-by: Pranav Gaikwad --- provider/internal/java/util.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/provider/internal/java/util.go b/provider/internal/java/util.go index 9aebffb2..6f4b2550 100644 --- a/provider/internal/java/util.go +++ b/provider/internal/java/util.go @@ -353,14 +353,10 @@ func explode(ctx context.Context, log logr.Logger, archivePath, projectPath stri if dep.foundOnline { dependencies = append(dependencies, dep) // copy this into m2 repo to avoid downloading again - destPath := m2Repo - for _, subPath := range strings.Split(dep.GroupId, ".") { - destPath = filepath.Join(destPath, subPath) - } - for _, subPath := range strings.Split(dep.ArtifactId, ".") { - destPath = filepath.Join(destPath, subPath) - } - destPath = filepath.Join(destPath, dep.Version, filepath.Base(filePath)) + groupPath := filepath.Join(strings.Split(dep.GroupId, ".")...) + artifactPath := filepath.Join(strings.Split(dep.ArtifactId, ".")...) + destPath := filepath.Join(m2Repo, groupPath, artifactPath, + dep.Version, filepath.Base(filePath)) if err := moveFile(filePath, destPath); err != nil { log.V(8).Error(err, "failed moving jar to m2 local repo") } else {