Skip to content

[java-shared-config] Ignore provided scoped dependencies from maven-dependency-plugin  #13743

Open

Description

@mpeddada1

This came up in an offline discussion with @burkedavison as part of googleapis/java-shared-config#815.

The downstream / dependencies (11, java-spanner) in the PR was failing with the following error:

[INFO] --- maven-dependency-plugin:3.5.0:analyze (default-cli) @ google-cloud-spanner ---
Error:  Used undeclared dependencies found:
Error:     org.graalvm.sdk:nativeimage:jar:24.0.1:provided

However, this dependency is intentionally scoped as provided making this failure a false positive.

Potential Solution: Set the maven-dependency-plugin's ignoreNonCompile parameter to true (https://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html#ignoreNonCompile) to ignore provided scoped dependencies when mvn dependency:analyze is called. The configuration change will likely be at:

https://github.com/googleapis/java-shared-config/blob/3c3c6307ea88dc56f5901a95c295d1b2d53a3559/java-shared-config/pom.xml#L144-L158

cc/ @suztomo

Activity

  1. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Jul 30, 2024
  2. suztomo commented on Aug 13, 2024

    @suztomo
    Member

    I agree with excluding the dependency in the plugin configuration.

  3. JoeWang1127 commented on Nov 11, 2024

    @JoeWang1127
    Contributor

    @mpeddada1 do we still need to eet the maven-dependency-plugin's ignoreNonCompile parameter to true after merging googleapis/sdk-platform-java#2706 and ignore the dependency in spanner?

  4. mpeddada1 commented on Jan 22, 2025

    @mpeddada1
    ContributorAuthor

    Thank you for the ping @JoeWang1127! I think this issue is still relevant as it applies to a more broader problem of how the mvn dependency:analyze check handles provided dependencies.

  5. added
    priority: p3Desirable enhancement or fix. May not be included in next release.
    and removed
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Jan 28, 2025
  6. added
    type: cleanupAn internal cleanup or hygiene concern.
    and removed
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Jun 30, 2025
  7. changed the title [-]Ignore provided scoped dependencies from maven-dependency-plugin [/-] [+][java-shared-config] Ignore provided scoped dependencies from maven-dependency-plugin [/+] on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p3Desirable enhancement or fix. May not be included in next release.type: cleanupAn internal cleanup or hygiene concern.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions