Skip to content

pkl_java_library build fail with missing java dependency #152

@tjoneslo

Description

@tjoneslo

In the upgrade of rules_java from 8.14.0 to 8.15.2 , the java compiler gets much picker about missing transitive dependencies.

As a result trying to build a pkl_java_library (like as follows)

pkl_java_library(
    name = "schema",
    srcs = [
        "//project/src/main/resources:schema.pkl",
    ],
    generate_getters = False,
    visibility = ["//:__subpackages__"],
)

fails with this error:

ConnectService.java:68: error: [strict] Using type org.pkl.core.Duration from an indirect dependency (TOOL_INFO: "@@rules_jvm_external++maven+rules_pkl_deps//:org_pkl_lang_pkl_core"). See command below **
    public final @NonNull Duration startStopTimeout;
                          ^
 ** Please add the following dependencies: 
  @@rules_jvm_external++maven+rules_pkl_deps//:org_pkl_lang_pkl_core to //project/src/main/java/com/config/pkl/schema:schema_compiled 

The obvious solution of adding pkl_java_deps = ["@rules_pkl//:org_pkl_lang_pkl_core"], to work around this problem the build then fails with the following:

ERROR: error loading package '@@rules_pkl+//': Unable to find package for @@[unknown repo 'bazel_gazelle' requested from @@rules_pkl+]//:def.bzl: The repository '@@[unknown repo 'bazel_gazelle' requested from @@rules_pkl+]' could not be resolved: No repository visible as '@bazel_gazelle' from repository '@@rules_pkl+'.
ERROR: /project/src/main/java/com/pkl/schema/BUILD.bazel:3:17: error loading package '@@rules_pkl+//': Unable to find package for @@[unknown repo 'bazel_gazelle' requested from @@rules_pkl+]//:def.bzl: The repository '@@[unknown repo 'bazel_gazelle' requested from @@rules_pkl+]' could not be resolved: No repository visible as '@bazel_gazelle' from repository '@@rules_pkl+'. and referenced by '//build:target'

Workaround: Downgrade your rules_java to 8.14.0 until this can be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions