mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
Refine license searching from groupIDFromJavaMetadata to allow for having the artfactId in the groupId (#2313)
Signed-off-by: Colm O hEigeartaigh <coheigea@apache.org>
This commit is contained in:
parent
e04d90fc9a
commit
3e8a2304e8
@ -268,6 +268,16 @@ func findLicenseFromJavaMetadata(name string, manifest *pkg.JavaManifest, versio
|
||||
log.Tracef("unable to get parent pom from Maven central: %v", err)
|
||||
}
|
||||
|
||||
if len(pomLicenses) == 0 {
|
||||
// Try removing the last part of the groupId, as sometimes it duplicates the artifactId
|
||||
packages := strings.Split(groupID, ".")
|
||||
groupID = strings.Join(packages[:len(packages)-1], ".")
|
||||
pomLicenses, err = recursivelyFindLicensesFromParentPom(groupID, name, version, j.cfg)
|
||||
if err != nil {
|
||||
log.Tracef("unable to get parent pom from Maven central: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(pomLicenses) > 0 {
|
||||
pkgLicenses := pkg.NewLicensesFromLocation(j.location, pomLicenses...)
|
||||
if pkgLicenses != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user