Skip to content

Bazel 9.0.0 build issue: rules_spring+/springboot/springboot.bzl:41:43: name 'JavaInfo' is not defined #283

@yakovliam

Description

@yakovliam

With the upgrade to Bazel 9.0.0, projects using rules_spring previously failed during analysis due to missing Java symbols in .bzl files, most notably in springboot.bzl.

Specifically, building a project that uses the springboot rule would produce the following error:


springboot.bzl:41:43: name 'JavaInfo' is not defined

This was caused by changes in Bazel 9 / Bzlmod where library-specific Starlark symbols are no longer implicitly available and must be explicitly provided via module dependencies. In this case, JavaInfo and other Java symbols were not available unless rules_java was declared as a dependency of rules_spring.

This has now been resolved in PR #282 by:

  • Adding rules_java to the MODULE.bazel of rules_spring so that Java toolchains and symbols are available project-wide.
  • Updating .bzl files (including springboot.bzl) to explicitly load the required symbols, for example:
load("@rules_java//java:defs.bzl", "java_binary", "JavaInfo")

java_binary is included where needed because it is also referenced in the same rule files.

Expected behavior: projects using rules_spring now build successfully under Bazel 9 without requiring downstream users to manually add rules_java or patch .bzl files.

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