Skip to content

Commit

Permalink
refactor: use maven central repo as later remote repo
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Feb 5, 2024
1 parent 97eafa0 commit 44a6ff0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/java/pom/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ func (p *parser) Parse(r dio.ReadSeekerAt) ([]types.Library, []types.Dependency,
return nil, nil, xerrors.Errorf("failed to parse POM: %w", err)
}

var remoteRepositories []string
for _, rep := range content.Repositories.Repository {
if rep.Releases.Enabled == "false" && rep.Snapshots.Enabled == "false" {
continue
}

repoURL, err := url.Parse(rep.URL)
if err != nil {
log.Logger.Debugf("Unable to parse remote repository url: %s", err)
continue
}

Expand All @@ -106,9 +108,12 @@ func (p *parser) Parse(r dio.ReadSeekerAt) ([]types.Library, []types.Dependency,
}

log.Logger.Debugf("Adding repository %s: %s", rep.ID, rep.URL)
p.remoteRepositories = append(p.remoteRepositories, repoURL.String())
remoteRepositories = append(remoteRepositories, repoURL.String())
}

// Add central maven repository or repositories obtained using `WithRemoteRepos` function.
remoteRepositories = append(remoteRepositories, p.remoteRepositories...)

root := &pom{
filePath: p.rootPath,
content: content,
Expand Down

0 comments on commit 44a6ff0

Please sign in to comment.