Build bazel plugins on java 21 for stable-3.11

stable-3.11 branch is verified on stable-17, but shipped on stable 21,
as per release plan [1].

Explicitly set --config=java21 when building plugins on stable-3.11

[1] https://www.gerritcodereview.com/2024-10-03-gerrit-3.11-release-plan.html#switch-to-java-21

Change-Id: I5572a18a19733fcdaad6347c0a38770c467be987
diff --git a/jenkins/gerrit-bazel-build-plugin.sh b/jenkins/gerrit-bazel-build-plugin.sh
index 8ed805a..54f5e1e 100644
--- a/jenkins/gerrit-bazel-build-plugin.sh
+++ b/jenkins/gerrit-bazel-build-plugin.sh
@@ -60,6 +60,11 @@
   bash -c "{setup}"
 fi
 
+if [ "{branch}" == "stable-3.11" ]; then
+  BAZEL_OPTS="$BAZEL_OPTS --config=java21"
+  echo -e "Build stable-3.11 on java21. BAZEL_OPTS = $BAZEL_OPTS"
+fi
+
 bazelisk build $BAZEL_OPTS $TARGETS
 bazelisk test $BAZEL_OPTS --test_env DOCKER_HOST=$DOCKER_HOST //tools/bzl:always_pass_test plugins/{name}/...