bazelbuild/rules_java

How can I get the special version?

Closed this issue · 3 comments

I'm having a problem with downloading the rules java package from github, do I use a proxy to download the package and copy it into the machine.

The question is how can I get the special version. For example 981f06c3d2bd10225e85209904090eb7b5fb26bd and how can I get the sha256, then I can use below config to load it.

        http_archive(
            name = "rules_java",
            sha256 = "f5a3e477e579231fca27bf202bb0e8fbe4fc6339d63b38ccb87c2760b533d1c3",
            strip_prefix = "rules_java-981f06c3d2bd10225e85209904090eb7b5fb26bd",
            urls = ["file:///tmp/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz"],
        )

@daohu527 if you are trying to reference a local repository then you want to use https://docs.bazel.build/versions/main/be/workspace.html#local_repository otherwise urls needs to be an actual URL that http_archive can download from. Ex:

        http_archive(
            name = "rules_java",
            sha256 = "f5a3e477e579231fca27bf202bb0e8fbe4fc6339d63b38ccb87c2760b533d1c3",
            strip_prefix = "rules_java-981f06c3d2bd10225e85209904090eb7b5fb26bd",
            urls = ["https://github.com/bazelbuild/rules_java/archive/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz"],
        )

Thx, it is better to use local_repository, http_archive is also feasible at present (use file:///).

My question is, how is the intermediate version determined?

My question is, how is the intermediate version determined?

That version is just the hash of some commit in this repo. You can download the archive from the github UI at a at chosen commit or construct the URL (like mentioned in #49 (comment)).

Computing the hash is simple, just run sha256sum <hash>.tar.gz