Remove duplication in `@rules_java` presubmit config

Brings all configs in sync

PiperOrigin-RevId: 702759908
Change-Id: I30848733e3a279a6622a751d4011f08a05bc01f7
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml
index 0f796c9..d61be6c 100644
--- a/.bazelci/presubmit.yml
+++ b/.bazelci/presubmit.yml
@@ -2,9 +2,9 @@
 build_targets: &build_targets
   - "//..."
   - "@remote_java_tools//java_tools/..."
-  # TODO: Look into broken targets in //toolchains
+  # can't build @remote_java_tools_X repos for other platforms
   - "-//toolchains/..."
-  # TODO: re-enable docs after protobuf is fixed
+  # TODO: re-enable docs after moving them out of https://bazel.build/reference/be/java
   - "-//java/docs/..."
   - "-//test:docs_up_to_date_test"
 
@@ -13,9 +13,25 @@
   - "@remote_java_tools//java_tools/..."
   - "//examples/..."
 
+build_targets_integration: &build_targets_integration
+  - "//..."
+  - "//:bin_deploy.jar"
+
 test_targets: &test_targets
   - "//test/..."
   - "//java/test/..."
+  # TODO: re-enable docs after moving them out of https://bazel.build/reference/be/java
+  - "-//test:docs_up_to_date_test"
+
+test_targets_bazel6: &test_targets_bazel6
+  - "//java/test/..."
+
+test_target_integration: &test_target_integration
+  - "//:MyTest"
+
+flags_workspace_integration: &flags_workspace_integration
+  - "--noenable_bzlmod"
+  - "--enable_workspace"
 
 buildifier: latest
 
@@ -26,10 +42,7 @@
     name: "Bazel 7.x"
     bazel: "7.4.0"
     build_targets: *build_targets
-    test_targets:
-      - "//test/..."
-      - "//java/test/..."
-      - "-//test:docs_up_to_date_test"
+    test_targets: *test_targets
   ubuntu2004_integration:
     name: "Bazel 7.x Integration"
     bazel: "7.4.0"
@@ -37,12 +50,8 @@
     working_directory: "test/repo"
     shell_commands:
       - sh setup.sh
-    build_targets:
-      - "//..."
-      - "//:bin_deploy.jar"
-      - "@rules_java//java/..."
-    test_targets:
-      - "//:MyTest"
+    build_targets: *build_targets_integration
+    test_targets: *test_target_integration
   ubuntu2004_integration_workspace:
     name: "Bazel 7.x Integration (WORKSPACE)"
     bazel: "7.4.0"
@@ -50,17 +59,10 @@
     working_directory: "test/repo"
     shell_commands:
       - sh setup.sh
-    build_targets:
-      - "//..."
-      - "//:bin_deploy.jar"
-    build_flags:
-      - "--noenable_bzlmod"
-      - "--enable_workspace"
-    test_targets:
-      - "//:MyTest"
-    test_flags:
-      - "--noenable_bzlmod"
-      - "--enable_workspace"
+    build_targets: *build_targets_integration
+    build_flags: *flags_workspace_integration
+    test_targets: *test_target_integration
+    test_flags: *flags_workspace_integration
   macos:
     name: "Bazel 7.x"
     bazel: "7.4.0"
@@ -75,6 +77,7 @@
     bazel: last_green
     platform: ubuntu2004
     build_targets: *build_targets
+    test_targets: *test_targets
   ubuntu2004_integration_head:
     name: "Bazel@HEAD Integration"
     bazel: last_green
@@ -82,12 +85,8 @@
     working_directory: "test/repo"
     shell_commands:
       - sh setup.sh
-    build_targets:
-      - "//..."
-      - "//:bin_deploy.jar"
-      - "@rules_java//java/..."
-    test_targets:
-      - "//:MyTest"
+    build_targets: *build_targets_integration
+    test_targets: *test_target_integration
   ubuntu2004_integration_head_workspace:
     name: "Bazel@HEAD Integration (WORKSPACE)"
     bazel: "last_green"
@@ -95,17 +94,10 @@
     working_directory: "test/repo"
     shell_commands:
       - sh setup.sh
-    build_targets:
-      - "//..."
-      - "//:bin_deploy.jar"
-    build_flags:
-      - "--noenable_bzlmod"
-      - "--enable_workspace"
-    test_targets:
-      - "//:MyTest"
-    test_flags:
-      - "--noenable_bzlmod"
-      - "--enable_workspace"
+    build_targets: *build_targets_integration
+    build_flags: *flags_workspace_integration
+    test_targets: *test_target_integration
+    test_flags: *flags_workspace_integration
   macos_head:
     name: "Bazel@HEAD"
     bazel: last_green
@@ -123,6 +115,7 @@
     bazel: 6.4.0
     platform: ubuntu2004
     build_targets: *build_targets_bazel6
+    test_targets: *test_targets_bazel6
   ubuntu2004_integration_bazel6:
     name: "Bazel 6.x Integration"
     bazel: 6.4.0
@@ -130,11 +123,8 @@
     working_directory: "test/repo"
     shell_commands:
     - sh setup.sh
-    build_targets:
-    - "//..."
-    - "//:bin_deploy.jar"
-    test_targets:
-    - "//:MyTest"
+    build_targets: *build_targets_integration
+    test_targets: *test_target_integration
   macos_bazel6:
     name: "Bazel 6.x"
     bazel: 6.4.0