Skip to content

Commit

Permalink
fix(pom): skipping missing modules (aquasecurity#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
liorj-orca authored and Sq34sy committed Jul 28, 2023
1 parent 3cabb7f commit 9ac4666
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkg/java/pom/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ func (p *parser) parseRoot(root artifact) ([]types.Library, []types.Dependency,
for _, relativePath := range result.modules {
moduleArtifact, err := p.parseModule(result.filePath, relativePath)
if err != nil {
return nil, nil, xerrors.Errorf("module error (%s): %w", relativePath, err)
log.Logger.Debugf("Unable to parse %q module: %s", result.filePath, err)
continue
}

queue.enqueue(moduleArtifact)
Expand Down
9 changes: 7 additions & 2 deletions pkg/java/pom/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,10 +924,15 @@ func TestPom_Parse(t *testing.T) {
},
},
{
name: "module not found",
name: "module not found - unable to parse module",
inputFile: filepath.Join("testdata", "not-found-module", "pom.xml"),
local: true,
wantErr: "stat testdata/not-found-module/module: no such file or directory",
want: []types.Library{
{
Name: "com.example:aggregation",
Version: "1.0.0",
},
},
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 9ac4666

Please sign in to comment.