maven-dependency-plugin
maven-dependency-plugin copied to clipboard
[MDEP-962] Verbose information missing
Frank Reyes opened MDEP-962 and commented
I noticed that when using -Dverbose=true it did include all packages in the output, but did not contain information on whether it was included or not (marked with parenthesis in the text output) and is missing the information about why it is excluded, other version, conflict etc.
Example: mvn dependency:tree -Dverbose=true
[INFO] --- dependency:3.6.1:tree (default-cli) @ attackvector ---
[INFO] org.evil:attackvector:jar:1.2
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.postgresql:postgresql:jar:42.6.0:compile
[INFO] | \- (org.checkerframework:checker-qual:jar:3.31.0:runtime - omitted for duplicate)
[INFO] +- org.springframework:spring-jdbc:jar:5.3.27:compile
[INFO] | +- org.springframework:spring-beans:jar:5.3.27:compile
[INFO] | | \- (org.springframework:spring-core:jar:5.3.27:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-core:jar:5.3.27:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.3.27:compile
[INFO] | \- org.springframework:spring-tx:jar:5.3.27:compile
[INFO] | +- (org.springframework:spring-beans:jar:5.3.27:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-core:jar:5.3.27:compile - omitted for duplicate)
[INFO] +- org.springframework.data:spring-data-relational:jar:2.4.11:compile
[INFO] | +- (org.springframework.data:spring-data-commons:jar:2.7.11:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-tx:jar:5.3.27:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-context:jar:5.3.27:compile
[INFO] | | +- org.springframework:spring-aop:jar:5.3.27:compile
[INFO] | | | +- (org.springframework:spring-beans:jar:5.3.27:compile - omitted for duplicate)
[INFO] | | | \- (org.springframework:spring-core:jar:5.3.27:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:5.3.27:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-core:jar:5.3.27:compile - omitted for duplicate)
[INFO] | | \- org.springframework:spring-expression:jar:5.3.27:compile
[INFO] | | \- (org.springframework:spring-core:jar:5.3.27:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:5.3.27:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:5.3.27:compile - omitted for duplicate)
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.32:compile
[INFO] +- org.springframework.data:spring-data-commons:jar:2.7.11:compile
[INFO] | +- (org.springframework:spring-core:jar:5.3.27:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:5.3.27:compile - omitted for duplicate)
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.32:compile - omitted for duplicate)
[INFO] \- org.checkerframework:checker-qual:jar:3.31.0:compile
This is the JSON generated by the plugin:
--- dependency:3.7.0:tree (default-cli) @ attackvector ---
[INFO] {
[INFO] "groupId": "org.evil",
[INFO] "artifactId": "attackvector",
[INFO] "version": "1.2",
[INFO] "type": "jar",
[INFO] "scope": "",
[INFO] "classifier": "",
[INFO] "optional": "false",
[INFO] "children": [
[INFO] {
[INFO] "groupId": "junit",
[INFO] "artifactId": "junit",
[INFO] "version": "4.11",
[INFO] "type": "jar",
[INFO] "scope": "test",
[INFO] "classifier": "",
[INFO] "optional": "false",
[INFO] "children": [
[INFO] {
[INFO] "groupId": "org.hamcrest",
[INFO] "artifactId": "hamcrest-core",
[INFO] "version": "1.3",
[INFO] "type": "jar",
[INFO] "scope": "test",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] }
[INFO] ]
[INFO] },
[INFO] {
[INFO] "groupId": "org.postgresql",
[INFO] "artifactId": "postgresql",
[INFO] "version": "42.6.0",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false",
[INFO] "children": [
[INFO] {
[INFO] "groupId": "org.checkerframework",
[INFO] "artifactId": "checker-qual",
[INFO] "version": "3.31.0",
[INFO] "type": "jar",
[INFO] "scope": "runtime",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] }
[INFO] ]
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-jdbc",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false",
[INFO] "children": [
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-beans",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false",
[INFO] "children": [
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-core",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] }
[INFO] ]
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-core",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false",
[INFO] "children": [
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-jcl",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] }
[INFO] ]
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-tx",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false",
[INFO] "children": [
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-beans",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-core",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] }
[INFO] ]
[INFO] }
[INFO] ]
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework.data",
[INFO] "artifactId": "spring-data-relational",
[INFO] "version": "2.4.11",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false",
[INFO] "children": [
[INFO] {
[INFO] "groupId": "org.springframework.data",
[INFO] "artifactId": "spring-data-commons",
[INFO] "version": "2.7.11",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-tx",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-context",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false",
[INFO] "children": [
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-aop",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false",
[INFO] "children": [
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-beans",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-core",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] }
[INFO] ]
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-beans",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-core",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-expression",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false",
[INFO] "children": [
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-core",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] }
[INFO] ]
[INFO] }
[INFO] ]
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-beans",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-core",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] },
[INFO] {
[INFO] "groupId": "org.slf4j",
[INFO] "artifactId": "slf4j-api",
[INFO] "version": "1.7.32",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] }
[INFO] ]
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework.data",
[INFO] "artifactId": "spring-data-commons",
[INFO] "version": "2.7.11",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false",
[INFO] "children": [
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-core",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] },
[INFO] {
[INFO] "groupId": "org.springframework",
[INFO] "artifactId": "spring-beans",
[INFO] "version": "5.3.27",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] },
[INFO] {
[INFO] "groupId": "org.slf4j",
[INFO] "artifactId": "slf4j-api",
[INFO] "version": "1.7.32",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] }
[INFO] ]
[INFO] },
[INFO] {
[INFO] "groupId": "org.checkerframework",
[INFO] "artifactId": "checker-qual",
[INFO] "version": "3.31.0",
[INFO] "type": "jar",
[INFO] "scope": "compile",
[INFO] "classifier": "",
[INFO] "optional": "false"
[INFO] }
[INFO] ]
[INFO] }
JSON file does not contain the information bounded between parenthesis: Ex: ...... - omitted for duplicate)
Affects: 3.7.0
Elias Lundell commented
I will be happy to create a PR to add this information. Some decisions must be made on how to represent this in the json format.
Here is a suggestion:
{
"groupId": "org.eclipse.jetty",
"artifactId": "jetty-server",
"version": "9.4.55.v20240627",
"type": "jar",
"scope": "test",
"classifier": "",
"optional": "false",
--- new ---
"included": true/false,
"excludedReason": "omitted for duplicate"/"omitted for conflict with $(winnerVersion)",
"versionManagedFrom": getPremanagedVersion(),
"scopeManagedFrom": getPremanagedScope(),
"scopeUpdatedFrom": data.getOriginalScope(),
"scopeNotUpdatedTo": data.getIgnoredScope()
}
Where included corresponds to the parenthesis of the normal output, and the rest of the keys (excludedReason, versionManagedFrom, etc) are only included if they have values.