From 3af33bc01959db1ae86f4f31e60ee7e968ffdba3 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Tue, 21 Nov 2023 18:53:46 +0100 Subject: [PATCH] GH-38832: [Java] Avoid building twice in `ci/scripts/java_build.sh` (#38829) ### Rationale for this change `ci/scripts/java_build.sh` can invoke `mvn install` several times on the Arrow Java codebase. This happens especially in JNI and Integration builds, which have some optional components enabled. ### What changes are included in this PR? Only invoke `mvn install` once. This change seems to save around 5 minutes on the JNI and Integration builds. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * Closes: #38832 Lead-authored-by: Antoine Pitrou Co-authored-by: Antoine Pitrou Co-authored-by: david dali susanibar arce Signed-off-by: Antoine Pitrou --- ci/scripts/java_build.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ci/scripts/java_build.sh b/ci/scripts/java_build.sh index 66ea8d677d187..77dd1ccdafa09 100755 --- a/ci/scripts/java_build.sh +++ b/ci/scripts/java_build.sh @@ -77,20 +77,20 @@ mvn="${mvn} -T 2C" pushd ${source_dir} -${mvn} install - if [ "${ARROW_JAVA_SHADE_FLATBUFFERS}" == "ON" ]; then - ${mvn} -Pshade-flatbuffers install + mvn="${mvn} -Pshade-flatbuffers" fi if [ "${ARROW_JAVA_CDATA}" = "ON" ]; then - ${mvn} -Darrow.c.jni.dist.dir=${java_jni_dist_dir} -Parrow-c-data install + mvn="${mvn} -Darrow.c.jni.dist.dir=${java_jni_dist_dir} -Parrow-c-data" fi if [ "${ARROW_JAVA_JNI}" = "ON" ]; then - ${mvn} -Darrow.cpp.build.dir=${java_jni_dist_dir} -Parrow-jni install + mvn="${mvn} -Darrow.cpp.build.dir=${java_jni_dist_dir} -Parrow-jni" fi +${mvn} install + if [ "${BUILD_DOCS_JAVA}" == "ON" ]; then # HTTP pooling is turned of to avoid download issues https://issues.apache.org/jira/browse/ARROW-11633 mkdir -p ${build_dir}/docs/java/reference