springboot(name, java_library, boot_app_class, deps, deps_exclude, deps_exclude_paths, deps_index_file, deps_use_starlark_order, dupeclassescheck_enable, dupeclassescheck_ignorelist, include_git_properties_file, bazelrun_script, bazelrun_jvm_flags, bazelrun_data, bazelrun_background, addins, tags, testonly, visibility, exclude, classpath_index, use_build_dependency_order, fail_on_duplicate_classes, duplicate_class_allowlist, jvm_flags, data)
Bazel rule for packaging an executable Spring Boot application.
Note that the rule README has more detailed usage instructions for each attribute.
PARAMETERS
| Name | Description | Default Value |
|---|---|---|
| name | Required. The name of the Spring Boot application. Typically this is set the same as the package name. Ex: helloworld. | none |
| java_library | Required. The built jar, identified by the name of the java_library rule, that contains the Spring Boot application. | none |
| boot_app_class | Required. The fully qualified name of the class annotated with @SpringBootApplication. Ex: com.sample.SampleMain | none |
| boot_launcher_class | Optional. Allows you to switch to the new org.springframework.boot.loader.launch.JarLauncher introduced in Boot 3.2.0. Defaults to the old launcher. | org.springframework.boot.loader.JarLauncher |
| deps | Optional. An additional set of Java dependencies to add to the executable. Normally all dependencies are set on the java_library. | None |
| deps_banned | Optional. A list of strings to match against the jar filenames in the transitive graph of dependencies for this springboot app. If any of these strings is found within any jar name, the rule will fail. This is useful for detecting jars that should never go to production. The list of dependencies is obtained after the deps_exclude processing has run. | None |
| deps_exclude | Optional. This attribute provides a list of partial paths that will be omitted from the final packaging step if the string is contained within the dep filename. This is a more raw method than deps_exclude for eliminating a problematic dependency/file that cannot be eliminated upstream. Ex: [jackson-databind-]. | None |
| deps_exclude_paths | - |
None |
| deps_index_file | Optional. Uses Spring Boot's classpath index feature to define classpath order. This feature is not commonly used, as the application must be extracted from the jar file for it to work. Ex: my_classpath_index.idx | None |
| deps_use_starlark_order | When running the Spring Boot application from the executable jar file, setting this attribute to True will use the classpath order as expressed by the order of deps in the BUILD file. Otherwise it is random order. | None |
| dupeclassescheck_enable | If True, will analyze the list of dependencies looking for any class that appears more than once, but with a different hash. This indicates that your dependency tree has conflicting libraries. | None |
| dupeclassescheck_ignorelist | Optional. When using the duplicate class check, this attribute provides a file that contains a list of libraries excluded from the analysis. Ex: dupeclass_libs.txt | None |
| include_git_properties_file | If True, will include a git.properties file in the resulting jar. | True |
| bazelrun_java_toolchain | Optional. When launching the application using 'bazel run', this attribute can identify the label of the Java toolchain used to launch the JVM. Ex: //tools/jdk:my_default_toolchain. See default_java_toolchain in the Bazel documentation. | None |
| bazelrun_script | Optional. When launching the application using 'bazel run', a default launcher script is used. This attribute can be used to provide a customized launcher script. Ex: my_custom_script.sh | None |
| bazelrun_jvm_flags | Optional. When launching the application using 'bazel run', an optional set of JVM flags to pass to the JVM at startup. Ex: -Dcustomprop=gold -DcustomProp2=silver | None |
| bazelrun_data | Uncommon option to add data files to runfiles. Behaves like the data attribute defined for java_binary. | None |
| bazelrun_background | Optional. If True, the bazel run launcher will not block. The run command will return and process will remain running. | False |
| addins | Uncommon option to add additional files to the root of the springboot jar. For example a license file. Pass an array of files from the package. | [] |
| tags | Optional. Bazel standard attribute. | [] |
| testonly | Optional. Bazel standard attribute. Defaults to False. | False |
| visibility | Optional. Bazel standard attribute. | None |
| exclude | Deprecated synonym of deps_exclude | [] |
| classpath_index | Deprecated synonym of deps_index_file | "@rules_spring//springboot:empty.txt" |
| use_build_dependency_order | Deprecated synonym of deps_use_starlark_order | True |
| fail_on_duplicate_classes | Deprecated synonym of dupeclassescheck_enable | False |
| duplicate_class_allowlist | Deprecated synonym of dupeclassescheck_ignorelist | None |
| jvm_flags | Deprecated synonym of bazelrun_jvm_flags | "" |
| data | Deprecated synonym of bazelrun_data | [] |