Skip to content

Ignore provided scoped dependencies from maven-dependency-plugin  #875

@mpeddada1

Description

@mpeddada1

This came up in an offline discussion with @burkedavison as part of #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:

<configuration>
<ignoredUnusedDeclaredDependencies>
<ignoredUnusedDeclaredDependency>javax.annotation:javax.annotation-api
</ignoredUnusedDeclaredDependency>
</ignoredUnusedDeclaredDependencies>
<!-- TODO: Try to remove these exclusions by updating handwritten libs -->
<ignoredNonTestScopedDependencies>
<ignoredNonTestScopedDependency>io.grpc:*
</ignoredNonTestScopedDependency>
<ignoredNonTestScopedDependency>com.google.protobuf:*
</ignoredNonTestScopedDependency>
<ignoredNonTestScopedDependency>com.google.api.grpc:*
</ignoredNonTestScopedDependency>
</ignoredNonTestScopedDependencies>
</configuration>

cc/ @suztomo

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