Run integration tests with `rules_java` distribution instead of repo source

Also build `@rules_java//java/...` as part of integration tests. Would have caught the v7.7.1 breakage (fixed by https://github.com/rules_java/bazel/commit/f7337ec36eb1fa78a3b4f641ccae7e5a2fe4a2b8) on presubmit.

PiperOrigin-RevId: 652899892
Change-Id: I1a225922c15803263d25d0b905debb75d3f814a2
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml
index 41c79ea..331d1e7 100644
--- a/.bazelci/presubmit.yml
+++ b/.bazelci/presubmit.yml
@@ -28,9 +28,12 @@
     name: "Integration Tests"
     platform: ubuntu2004
     working_directory: "test/repo"
+    shell_commands:
+      - sh setup.sh
     build_targets:
       - "//..."
       - "//:bin_deploy.jar"
+      - "@rules_java//java/..."
   macos:
     build_targets: *build_targets
   windows:
diff --git a/test/repo/MODULE.bazel b/test/repo/MODULE.bazel
index 10460a8..9289fcd 100644
--- a/test/repo/MODULE.bazel
+++ b/test/repo/MODULE.bazel
@@ -1,7 +1,7 @@
 module(name = "fake_repo_for_testing")
 
 bazel_dep(name = "rules_java", version = "7.5.0")
-local_path_override(
+archive_override(
     module_name = "rules_java",
-    path = "../../",
+    urls = ["file:///tmp/rules_java-HEAD.tar.gz"],
 )
diff --git a/test/repo/setup.sh b/test/repo/setup.sh
new file mode 100644
index 0000000..4c268fc
--- /dev/null
+++ b/test/repo/setup.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+cd ../../
+bazel build //distro:all
+cp -f bazel-bin/distro/rules_java-*.tar.gz /tmp/rules_java-HEAD.tar.gz
\ No newline at end of file