bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.32k stars 4.09k forks source link

Strict java check is failing although I have the correct dependency list #24502

Closed fzakaria closed 5 days ago

fzakaria commented 5 days ago

Description of the bug:

Here I am building some test:

> bazel build //controller:src/test/java/io/confluent/unified/storage/controller/ProtobufFailureDetectionTest 

        final LogicalPrincipal logicalPrincipal = LogicalPrincipal
              ^
 ** Please add the following dependencies:
  @maven//:io_confluent_auth_dataplane_auth_dataplane_v2 to //controller:src/test/java/io/confluent/unified/storage/controller/ProtobufFailureDetectionTest
 ** You can use the following buildozer command:
buildozer 'add deps @maven//:io_confluent_auth_dataplane_auth_dataplane_v2' //controller:src/test/java/io/confluent/unified/storage/controller/ProtobufFailureDetectionTest

I check my BUILD file

java_junit5_test(
    name = "ProtobufFailureDetectionTest",
    srcs = [
        "src/test/java/io/confluent/unified/storage/controller/ProtobufFailureDetectionTest.java",
    ],
    test_class = "io.confluent.unified.storage.controller.ProtobufFailureDetectionTest",
    runtime_deps = [
        "@maven//:org_apache_logging_log4j_log4j_slf4j_impl",
        "@maven//:org_junit_jupiter_junit_jupiter_engine",
        "@maven//:org_junit_platform_junit_platform_launcher",
        "@maven//:org_junit_platform_junit_platform_reporting",
    ],
    deps = [
        "@maven//:io_confluent_auth_dataplane_auth_dataplane_v2",
        "@maven//:org_junit_jupiter_junit_jupiter_api",
    ],
)

I validate with query that it is present.

> bazel query "deps(//controller:src/test/java/io/confluent/unified/storage/controller/ProtobufFailureDetectionTest)" | grep "@maven" | grep dataplane_auth
...
@maven//:io_confluent_auth_dataplane_auth_dataplane_v2

Which category does this issue belong to?

Java Rules

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

No response

Which operating system are you running Bazel on?

MacOS

What is the output of bazel info release?

release 7.4.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

fzakaria commented 5 days ago

Turns out this source file was part of another glob and I was looking at the wrong target :( I thought 1 source == 1 target in Bazel; TIL that's not the case.