Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mpeddada1 opened this issue Jul 30, 2024 · 1 comment
Open

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

mpeddada1 opened this issue Jul 30, 2024 · 1 comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@mpeddada1
Copy link
Contributor

mpeddada1 commented Jul 30, 2024

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

@mpeddada1 mpeddada1 added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jul 30, 2024
@suztomo
Copy link
Member

suztomo commented Aug 13, 2024

I agree with excluding the dependency in the plugin configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants