salesforce / salesforce/rules_spring

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

Open
#283 0 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Starlark
Stars
257
Forks
58
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review PR #282 alongside MODULE.bazel and the .bzl files mentioned in the issue, especially springboot/springboot.bzl. Start by reproducing the analysis failure with Bazel 9.0.0, then verify that the updated dependency and explicit symbol loads allow a project using the springboot rule to build without downstream rules_java changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.