GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: maven-dependency-plugin configuration breaking downstream config by BenWhitehead · Pull Request #174 · googleapis/java-shared-config

This repository was archived by the owner on Sep 30, 2026. It is now read-only.

Conversation

@BenWhitehead

@BenWhitehead BenWhitehead commented Jun 25, 2020

Copy link
Copy Markdown
Contributor

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 cd635ad, 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 cd635ad
[DEBUG] Goal:          org.apache.maven.plugins:maven-dependency-plugin:3.1.2:analyze (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <analyzer default-value="default">${analyzer}</analyzer>
  <baseDir default-value="${basedir}"/>
  <failOnWarning default-value="false">${failOnWarning}</failOnWarning>
  <ignoreNonCompile default-value="false">${ignoreNonCompile}</ignoreNonCompile>
  <ignoredUnusedDeclaredDependencies>
    <ignoredUnusedDeclaredDependency>com.google.http-client:google-http-client-jackson2</ignoredUnusedDeclaredDependency>
    <ignoredUnusedDeclaredDependency>com.google.oauth-client:google-oauth-client</ignoredUnusedDeclaredDependency>
    <ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependencies>
  <outputDirectory default-value="${project.build.directory}"/>
  <outputXML default-value="false">${outputXML}</outputXML>
  <project default-value="${project}"/>
  <scriptableFlag default-value="$$$%%%">${scriptableFlag}</scriptableFlag>
  <scriptableOutput default-value="false">${scriptableOutput}</scriptableOutput>
  <skip default-value="false">${mdep.analyze.skip}</skip>
  <verbose default-value="false">${verbose}</verbose>
</configuration>
Resolved config now
[DEBUG] Goal:          org.apache.maven.plugins:maven-dependency-plugin:3.1.2:analyze (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <analyzer default-value="default">${analyzer}</analyzer>
  <baseDir default-value="${basedir}"/>
  <failOnWarning default-value="false">${failOnWarning}</failOnWarning>
  <ignoreNonCompile default-value="false">${ignoreNonCompile}</ignoreNonCompile>
  <ignoredUnusedDeclaredDependencies>
    <ignoredUnusedDeclaredDependency>com.google.http-client:google-http-client-jackson2</ignoredUnusedDeclaredDependency>
    <ignoredUnusedDeclaredDependency>com.google.oauth-client:google-oauth-client</ignoredUnusedDeclaredDependency>
    <ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependency>
  </ignoredUnusedDeclaredDependencies>
  <outputDirectory default-value="${project.build.directory}"/>
  <outputXML default-value="false">${outputXML}</outputXML>
  <project default-value="${project}"/>
  <scriptableFlag default-value="$$$%%%">${scriptableFlag}</scriptableFlag>
  <scriptableOutput default-value="false">${scriptableOutput}</scriptableOutput>
  <skip default-value="false">${mdep.analyze.skip}</skip>
  <verbose default-value="false">${verbose}</verbose>
</configuration>

Diff between resolved configs
12c12,13
<     <ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependencies>
---
>     <ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependency>
>   </ignoredUnusedDeclaredDependencies>

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@BenWhitehead
fix: maven-dependency-plugin configuration breaking downstream config
e93257b
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 cd635ad, 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 cd635ad
```
[DEBUG] Goal:          org.apache.maven.plugins:maven-dependency-plugin:3.1.2:analyze (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <analyzer default-value="default">${analyzer}</analyzer>
  <baseDir default-value="${basedir}"/>
  <failOnWarning default-value="false">${failOnWarning}</failOnWarning>
  <ignoreNonCompile default-value="false">${ignoreNonCompile}</ignoreNonCompile>
  <ignoredUnusedDeclaredDependencies>
    <ignoredUnusedDeclaredDependency>com.google.http-client:google-http-client-jackson2</ignoredUnusedDeclaredDependency>
    <ignoredUnusedDeclaredDependency>com.google.oauth-client:google-oauth-client</ignoredUnusedDeclaredDependency>
    <ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependencies>
  <outputDirectory default-value="${project.build.directory}"/>
  <outputXML default-value="false">${outputXML}</outputXML>
  <project default-value="${project}"/>
  <scriptableFlag default-value="$$$%%%">${scriptableFlag}</scriptableFlag>
  <scriptableOutput default-value="false">${scriptableOutput}</scriptableOutput>
  <skip default-value="false">${mdep.analyze.skip}</skip>
  <verbose default-value="false">${verbose}</verbose>
</configuration>
```

###### Resolved config now
```
[DEBUG] Goal:          org.apache.maven.plugins:maven-dependency-plugin:3.1.2:analyze (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <analyzer default-value="default">${analyzer}</analyzer>
  <baseDir default-value="${basedir}"/>
  <failOnWarning default-value="false">${failOnWarning}</failOnWarning>
  <ignoreNonCompile default-value="false">${ignoreNonCompile}</ignoreNonCompile>
  <ignoredUnusedDeclaredDependencies>
    <ignoredUnusedDeclaredDependency>com.google.http-client:google-http-client-jackson2</ignoredUnusedDeclaredDependency>
    <ignoredUnusedDeclaredDependency>com.google.oauth-client:google-oauth-client</ignoredUnusedDeclaredDependency>
    <ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependency>
  </ignoredUnusedDeclaredDependencies>
  <outputDirectory default-value="${project.build.directory}"/>
  <outputXML default-value="false">${outputXML}</outputXML>
  <project default-value="${project}"/>
  <scriptableFlag default-value="$$$%%%">${scriptableFlag}</scriptableFlag>
  <scriptableOutput default-value="false">${scriptableOutput}</scriptableOutput>
  <skip default-value="false">${mdep.analyze.skip}</skip>
  <verbose default-value="false">${verbose}</verbose>
</configuration>

```

##### Diff between resolved configs
```diff
12c12,13
<     <ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependencies>
---
>     <ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api</ignoredUnusedDeclaredDependency>
>   </ignoredUnusedDeclaredDependencies>
```
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 25, 2020
@BenWhitehead BenWhitehead mentioned this pull request Jun 25, 2020
build(deps): update dependency com.google.cloud:google-cloud-shared-config to v0.9.0 googleapis/java-datastore#183
Closed
1 task
chingor13
chingor13 approved these changes Jul 1, 2020
View reviewed changes
@chingor13
chingor13 merged commit 507217f into googleapis:master Jul 1, 2020
@BenWhitehead
BenWhitehead deleted the fix-ignore-unused-javax-config branch July 1, 2020 16:16
gcf-merge-on-green Bot pushed a commit that referenced this pull request Jul 1, 2020
@release-please
chore: release 0.9.1 (#179)
60c03c8
🤖 I have created a release \*beep\* \*boop\* 
---
### [0.9.1](https://www.github.com/googleapis/java-shared-config/compare/v0.9.0...v0.9.1) (2020-07-01)


### Bug Fixes

* maven-dependency-plugin configuration breaking downstream config ([#174](https://www.github.com/googleapis/java-shared-config/issues/174)) ([507217f](https://www.github.com/googleapis/java-shared-config/commit/507217fe509cd4f16eb50c8075ab43229238e08d))


### Documentation

* change Devsite output path to /java/docs/reference ([#176](https://www.github.com/googleapis/java-shared-config/issues/176)) ([8b98af5](https://www.github.com/googleapis/java-shared-config/commit/8b98af54bf503d97bb86b6d02a5c4301b39384e1))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
This was referenced Jan 4, 2022
chore(main): release java-shared-config 0.11.4 #385
Closed
chore(main): release java-shared-config 0.11.4 #386
Closed
chore(main): release java-shared-config 0.11.4 #387
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@chingor13 chingor13 chingor13 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@BenWhitehead @chingor13 @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.