def METHOD_NAME(name, main_class, deps, srcs, resources = []):
    # Code style checking for sources
    if "checkstyle" not in native.existing_rules().keys():
        checkstyle()
    # Create the subrule names
    appcompile_rule = "app"
    dep_aggregator_rule = "deps"
    genmanifest_rule = "genmanifest"
    genjar_rule = "genjar"
    # for resources, assume all files in the standard location unless overridden by config
    if len(resources) == 0:
        resources = native.glob(["src/main/resources/**/*"])
    found = False
    merged_log4j = "src/main/resources/log4j2.properties"
    for idx, resource in enumerate(resources):
        if resource.rfind("src/main/resources/log4j2-custom.properties") != -1:
            native.genrule(
                name = "merged_log4j_target",
                cmd = "cat $(location src/main/resources/log4j-custom.properties) $(location //tools/build:log4j2.properties) >> $@",
                outs = [merged_log4j],
                srcs = [resource, "//tools/build:log4j2.properties"],
            )
            resources[idx] = merged_log4j
            found = True
    if found == False:
        native.genrule(
            name = "merged_log4j_target",
            cmd = "cp $< $@",
            outs = [merged_log4j],
            srcs = ["//tools/build:log4j2.properties"],
        )
        resources.append(merged_log4j)
    resources.append("//:VERSION")
    # SUBRULE 1: COMPILE THE SPRING BOOT APPLICATION
    java_binary(
        name = appcompile_rule,
        srcs = srcs,
        resources = resources,
        main_class = main_class,
        # Add parameters to enable this jdbi feature http://jdbi.org/#_compiling_with_parameter_names
        javacopts = ["-parameters"],
        deps = deps,
    )
    # SUBRULE 2: AGGREGATE UPSTREAM DEPS
    #  Aggregate transitive closure of upstream Java deps
    _depaggregator_rule(
        name = dep_aggregator_rule,
        deps = deps,
    )
    # SUBRULE 3: GENERATE THE MANIFEST
    #  NICER: derive the Build JDK and Boot Version values by scanning transitive deps
    genmanifest_cmd = "echo 'Manifest-Version: 1.0' >$@;" + \
                      "echo 'Created-By: Bazel' >>$@;" + \
                      "echo 'Built-By: Bazel' >>$@;" + \
                      "echo 'Main-Class: org.springframework.boot.loader.JarLauncher' >>$@;" + \
                      "echo 'Spring-Boot-Classes: BOOT-INF/classes/' >>$@;" + \
                      "echo 'Spring-Boot-Lib: BOOT-INF/lib/' >>$@;" + \
                      "echo 'Start-Class: " + main_class + "' >>$@;"
    genmanifest_out = "MANIFEST.MF"
    native.genrule(
        name = genmanifest_rule,
        cmd = genmanifest_cmd,
        message = "SpringBoot rule is writing the MANIFEST.MF...",
        outs = [genmanifest_out],
    )
    # SUBRULE 4: INVOKE THE BASH SCRIPT THAT DOES THE PACKAGING
    # The resolved input_file_paths array is made available as the $(SRCS) token in the cmd string.
    # Starlark will convert the logical input_file_paths into real file system paths when surfaced in $(SRCS)
    #  cmd format (see springboot_pkg.sh)
    #    param1: boot application classname (the @SpringBootApplication class)
    #    param2: executable jar output filename to write to
    #    param3: compiled application jar
    #    param4: manifest file
    #    paramN: upstream transitive dependency jar(s)
    native.genrule(
        name = genjar_rule,
        srcs = [":" + appcompile_rule, ":" + genmanifest_rule, ":" + dep_aggregator_rule],
        cmd = "$(location //tools/build:springboot_pkg.sh) " + main_class + " $@ $(SRCS)",
        tools = ["//tools/build:springboot_pkg.sh"],
        outs = ["app_springboot.jar"],
    )
    container_image(
        name = "image",
        base = "//:base_image",
        files = [":genjar"],
        cmd = [
            "app_springboot.jar",
            "-XshowSettings:vm",
            "-XX:MaxRAMPercentage=70",
            "-XX:-UseCompressedOops",
            "-Dsun.net.inetaddr.ttl=0",
        ],
    )
    # MASTER RULE: Create the composite rule that will aggregate the outputs of the subrules
    _springboot_rule(
        name = name,
        app_compile_rule = ":" + appcompile_rule,
        dep_aggregator_rule = ":" + dep_aggregator_rule,
        genmanifest_rule = ":" + genmanifest_rule,
        genjar_rule = ":" + genjar_rule,
        deps = deps,
    )