Skip to content

java_single_jar stamping #352

@benjaminp

Description

@benjaminp

I was trying to replace a usage of java_binary's _deploy.jar with java_single_jar rule but was stymied by different stamping behavior.

$ cat BUILD
load("@rules_java//java:java_binary.bzl", "java_binary")
load("@rules_java//java:java_single_jar.bzl", "java_single_jar")

java_binary(
    name = "a",
    main_class = "none",
)

java_single_jar(
    name = "b",
    exclude_build_data = False,
)
$ bazel build --embed_label="foo" --stamp  //:a_deploy.jar //:b
$ unzip -c bazel-bin/a_deploy.jar  build-data.properties
Archive:  bazel-bin/a_deploy.jar
  inflating: build-data.properties   
build.target=@@//:a
main.class=none
build.label=foo
build.time=Thu Feb 26 20\:21\:01 2026 (1772137261)
build.timestamp=1772137261
build.timestamp.as.int=1772137261
$ unzip -c bazel-bin/b.jar  build-data.properties
Archive:  bazel-bin/b.jar
 extracting: build-data.properties   
build.target=bazel-out/k8-fastbuild/bin/b.jar

Is there some way to make b.jar's build-data.properties have the same content as a_deploy.jar's?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2We'll consider to work on this in future. (Assignee optional)questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions