diff --git a/build.sh b/build.sh
index d2f701bb8088bb..55c5bacb919001 100755
--- a/build.sh
+++ b/build.sh
@@ -1591,13 +1591,12 @@ if [[ "${OUTPUT_BE_BINARY}" -eq 1 ]]; then
mkdir "${BE_HADOOP_HDFS_DIR}"
HADOOP_DEPS_JAR_DIR="${DORIS_HOME}/fe/be-java-extensions/${HADOOP_DEPS_NAME}/target"
echo "HADOOP_DEPS_JAR_DIR: ${HADOOP_DEPS_JAR_DIR}"
- if [[ "${BUILD_BE_JAVA_EXTENSIONS}" -eq 1 && ! -d "${HADOOP_DEPS_JAR_DIR}/lib" ]]; then
- echo "WARN: lib directory missing (likely due to Maven cache). Regenerating..."
- pushd "${DORIS_HOME}/fe/be-java-extensions/${HADOOP_DEPS_NAME}"
- "${MVN_CMD}" dependency:copy-dependencies -DskipTests -Dcheckstyle.skip=true
- mv target/dependency target/lib
- popd
- fi
+ # target/lib is present even when the Maven build cache restored this module instead of
+ # building it: fe/.mvn/maven-build-cache-config.xml forces copy-dependencies to run on a
+ # cache hit, for hadoop-deps and every plugin alike. There used to be a fallback here
+ # that re-ran the goal from the command line when the directory was missing; besides
+ # covering only this one module, it ran the goal without the pom's runtime-scope
+ # filter and so put the test-scope closure (JUnit and friends) into lib/hadoop_hdfs.
if [[ -f "${HADOOP_DEPS_JAR_DIR}/${HADOOP_DEPS_NAME}.jar" ]]; then
echo "Copy Be Extensions hadoop deps jar to ${BE_HADOOP_HDFS_DIR}"
cp "${HADOOP_DEPS_JAR_DIR}/${HADOOP_DEPS_NAME}.jar" "${BE_HADOOP_HDFS_DIR}"
diff --git a/fe/.mvn/maven-build-cache-config.xml b/fe/.mvn/maven-build-cache-config.xml
index 59c73b6dafbce0..3643d9a32b1846 100644
--- a/fe/.mvn/maven-build-cache-config.xml
+++ b/fe/.mvn/maven-build-cache-config.xml
@@ -63,14 +63,42 @@ under the License.
-
+
validate
+
+
+
+ wipe-plugin-lib
+
+
+
+
+
+
+ copy-dependencies
+
+
+
diff --git a/fe/be-java-extensions/pom.xml b/fe/be-java-extensions/pom.xml
index 6758f919a8a299..5b61be24269ec0 100644
--- a/fe/be-java-extensions/pom.xml
+++ b/fe/be-java-extensions/pom.xml
@@ -106,8 +106,11 @@ under the License.
copy-dependencies refills it makes an incremental build's plugin directory equal to a
clean one's.
- A cache-restored module skips both executions and keeps the target/lib its own last
- real build wrote, which is consistent for the same reason.
+ Both executions are also forced under runAlways in fe/.mvn/maven-build-cache-config.xml.
+ A build-cache hit restores the module jar and nothing else, so without that a cache-
+ restored module has no target/lib at all: harmless on a working copy, which still
+ holds the directory its last real build wrote, but CI wipes target/ before every
+ build while the cache survives, and deployed every plugin empty.
-->
org.apache.maven.plugins