From e93257b1e9faf15ffb180ffee540e78cb9b040f8 Mon Sep 17 00:00:00 2001 From: BenWhitehead Date: Thu, 25 Jun 2020 17:51:16 -0400 Subject: [PATCH] fix: maven-dependency-plugin configuration breaking downstream config When providing configuration to the maven-dependency-plugin, `ignoredUnusedDeclaredDependencies` is a `java.lang.String[]` but mavens xml handling allows multiple formats for providing a list of values (comma separated string, or sub elements each specifying a single value). It appears that when loading the config, the value of the configuration at a lower level is blindly pre-pended as a string rather than first parsing and merging the results. Below is the debug output of the resolved configuration using the existing config added in cd635ad6, the output after this change and a diff of the two. Notice, in the left hand side of the diff the malformed xml. The change introduced in this commit switches from using the comma separated string representation, to using the sub element representation thereby allowing the config resolution to create a valid config. ###### Resolved config as of cd635ad6 ``` [DEBUG] Goal: org.apache.maven.plugins:maven-dependency-plugin:3.1.2:analyze (default-cli) [DEBUG] Style: Regular [DEBUG] Configuration: ${analyzer} ${failOnWarning} ${ignoreNonCompile} com.google.http-client:google-http-client-jackson2 com.google.oauth-client:google-oauth-client javax.annotation:javax.annotation-apijavax.annotation:javax.annotation-api ${outputXML} ${scriptableFlag} ${scriptableOutput} ${mdep.analyze.skip} ${verbose} ``` ###### Resolved config now ``` [DEBUG] Goal: org.apache.maven.plugins:maven-dependency-plugin:3.1.2:analyze (default-cli) [DEBUG] Style: Regular [DEBUG] Configuration: ${analyzer} ${failOnWarning} ${ignoreNonCompile} com.google.http-client:google-http-client-jackson2 com.google.oauth-client:google-oauth-client javax.annotation:javax.annotation-api ${outputXML} ${scriptableFlag} ${scriptableOutput} ${mdep.analyze.skip} ${verbose} ``` ##### Diff between resolved configs ```diff 12c12,13 < javax.annotation:javax.annotation-apijavax.annotation:javax.annotation-api --- > javax.annotation:javax.annotation-api > ``` --- pom.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f9dcb0ec..6b3e5fad 100644 --- a/pom.xml +++ b/pom.xml @@ -194,7 +194,9 @@ maven-dependency-plugin 3.1.2 - javax.annotation:javax.annotation-api + + javax.annotation:javax.annotation-api +