diff --git a/pkg/dependency/parser/java/pom/parse_test.go b/pkg/dependency/parser/java/pom/parse_test.go index ebd47cdae4a1..934085d5d536 100644 --- a/pkg/dependency/parser/java/pom/parse_test.go +++ b/pkg/dependency/parser/java/pom/parse_test.go @@ -979,6 +979,14 @@ func TestPom_Parse(t *testing.T) { }, }, }, + // ➜ mvn dependency:tree + // ... + // [INFO] + // [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ child --- + // [INFO] com.example:child:jar:3.0.0 + // [INFO] \- org.example:example-exclusions:jar:3.0.0:compile + // [INFO] \- org.example:example-nested:jar:3.3.3:compile + // [INFO] ------------------------------------------------------------------------ { name: "exclusions in child and parent dependency management", inputFile: filepath.Join("testdata", "exclusions-parent-dependency-management", "child", "pom.xml"), @@ -992,9 +1000,9 @@ func TestPom_Parse(t *testing.T) { Relationship: ftypes.RelationshipRoot, }, { - ID: "org.example:example-nested:3.3.3", - Name: "org.example:example-nested", - Version: "3.3.3", + ID: "org.example:example-exclusions:3.0.0", + Name: "org.example:example-exclusions", + Version: "3.0.0", Relationship: ftypes.RelationshipDirect, Locations: ftypes.Locations{ { @@ -1004,9 +1012,9 @@ func TestPom_Parse(t *testing.T) { }, }, { - ID: "org.example:example-dependency:1.2.3", - Name: "org.example:example-dependency", - Version: "1.2.3", + ID: "org.example:example-nested:3.3.3", + Name: "org.example:example-nested", + Version: "3.3.3", Relationship: ftypes.RelationshipIndirect, }, }, @@ -1014,13 +1022,13 @@ func TestPom_Parse(t *testing.T) { { ID: "com.example:child:3.0.0", DependsOn: []string{ - "org.example:example-nested:3.3.3", + "org.example:example-exclusions:3.0.0", }, }, { - ID: "org.example:example-nested:3.3.3", + ID: "org.example:example-exclusions:3.0.0", DependsOn: []string{ - "org.example:example-dependency:1.2.3", + "org.example:example-nested:3.3.3", }, }, }, diff --git a/pkg/dependency/parser/java/pom/testdata/exclusions-parent-dependency-management/child/pom.xml b/pkg/dependency/parser/java/pom/testdata/exclusions-parent-dependency-management/child/pom.xml index acec708b691a..967033369b92 100644 --- a/pkg/dependency/parser/java/pom/testdata/exclusions-parent-dependency-management/child/pom.xml +++ b/pkg/dependency/parser/java/pom/testdata/exclusions-parent-dependency-management/child/pom.xml @@ -25,11 +25,11 @@ org.example - example-nested + example-exclusions org.example - example-api-common + example-dependency diff --git a/pkg/dependency/parser/java/pom/testdata/exclusions-parent-dependency-management/pom.xml b/pkg/dependency/parser/java/pom/testdata/exclusions-parent-dependency-management/pom.xml index 5735825405b0..d5093a29ab59 100644 --- a/pkg/dependency/parser/java/pom/testdata/exclusions-parent-dependency-management/pom.xml +++ b/pkg/dependency/parser/java/pom/testdata/exclusions-parent-dependency-management/pom.xml @@ -22,12 +22,12 @@ org.example - example-nested - 3.3.3 + example-exclusions + 3.0.0 org.example - example-api + example-dependency2 diff --git a/pkg/dependency/parser/java/pom/testdata/repository/org/example/example-exclusions/3.0.0/example-exclusions-3.0.0.pom b/pkg/dependency/parser/java/pom/testdata/repository/org/example/example-exclusions/3.0.0/example-exclusions-3.0.0.pom new file mode 100644 index 000000000000..57f908f362f5 --- /dev/null +++ b/pkg/dependency/parser/java/pom/testdata/repository/org/example/example-exclusions/3.0.0/example-exclusions-3.0.0.pom @@ -0,0 +1,27 @@ + + 4.0.0 + + org.example + example-exclusions + 3.0.0 + + + + org.example + example-dependency + 1.2.3 + + + org.example + example-dependency2 + 2.3.4 + + + org.example + example-nested + 3.3.3 + + + +