This repository contains the Spring Boot rule for the Bazel build system. It enables Bazel to build Spring Boot applications and package them as an executable jar file. The executable jar is the best way to deploy your Spring Boot application in production environments.
The Salesforce springboot rule can be found, along with documentation, in this directory:
- springboot: a Bazel extension to build and package Spring Boot applications
This rule was developed and is supported by Salesforce. If you have any issues with this repository, please create a GitHub Issue. We will try to quickly address problems and answer questions. Note that we do not yet support running these rules on Windows.
Ongoing development is planned and tracked using this GitHub repository's Project Manager. To see what bug fixes and new features are planned, consult the roadmaps located there.
Please do us a huge favor. If you think this project could be useful for you, now or in the future, please hit the Star button at the top. That helps us advocate for more time and resources on this project. Thanks!
Before you can use the rule in your BUILD files, you need to add it to your workspace.
Reference an official release This loads a pre-built version of this rule into your workspace during the build. This is the recommended approach for most users.
http_archive(
name = "rules_spring",
sha256 = "fa067d7ed07437a3be3a211564f485648fc9f2ecc827a189d98b60dc5a078fa2",
urls = [
"https://github.com/salesforce/rules_spring/releases/download/2.3.0/rules-spring-2.3.0.zip",
],
)
Do not use a git_repository rule with our main branch If you choose not to use an official release, you may be tempted to use a git_repository workspace rule to point to our main branch, Please do not do this, as we use main for ongoing work. We may check breaking changes into main at any time.
If you don't need to create a runnable executable jar file, there is an alternate approach to Spring Boot in the rules_jvm_external repository. That approach is sufficient if Bazel and your Bazel workspace (i.e. source code) are available in all environments that launch the application.
At Salesforce, Bazel is not available in production environments, and so this alternate approach is not viable.
This section contains notes for specific upgrade steps needed to adopt newer versions of rules-spring. Starting with the 1.1.x line, we strive to adhere to SemVer. This Git repository was renamed from bazel-springboot-rule to rules_spring on March 17, 2021. This was done to comply with required Bazel naming conventions for external rules.
This release refactored the rule with the standardized Bazel rule layout conventions. When the Spring Boot rule was originally written, the conventions did not exist. This repackaging makes the rule more modern.
For rule 1.x users upgrading to 2.0.0, you will need to do the following:
- All WORKSPACE and BUILD file references to bazel_springboot_rule must be changed to rules_spring
- All BUILD and .bzl file references to //tools/springboot must be changed to //springboot
See Repackaging work item for more details.