You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2022/09/18 05:38:16 UTC

[arrow] branch master updated: ARROW-17560: [Java][Gandiva] Move JNI build configuration from cpp/ to java/ (#14159)

This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 99179603e6 ARROW-17560: [Java][Gandiva] Move JNI build configuration from cpp/ to java/ (#14159)
99179603e6 is described below

commit 99179603e6db36b65750bf2d1fbc70545baaffeb
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Sun Sep 18 14:38:08 2022 +0900

    ARROW-17560: [Java][Gandiva] Move JNI build configuration from cpp/ to java/ (#14159)
    
    Authored-by: Sutou Kouhei <ko...@clear-code.com>
    Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
 ci/docker/fedora-35-cpp.dockerfile                 |   1 -
 ci/docker/java-jni-manylinux-201x.dockerfile       |   3 +-
 ci/docker/linux-apt-jni.dockerfile                 |   1 -
 ci/scripts/cpp_build.sh                            |   1 -
 ci/scripts/java_build.sh                           |   2 +-
 ci/scripts/java_jni_build.sh                       |   1 +
 ci/scripts/java_jni_macos_build.sh                 |   3 -
 ci/scripts/java_jni_manylinux_build.sh             |   3 -
 cpp/build-support/lint_exclusions.txt              |   5 +-
 cpp/cmake_modules/DefineOptions.cmake              |   2 -
 cpp/cmake_modules/ThirdpartyToolchain.cmake        |  10 +-
 cpp/src/arrow/ArrowConfig.cmake.in                 |  12 +--
 cpp/src/gandiva/CMakeLists.txt                     |   8 +-
 cpp/src/gandiva/GandivaConfig.cmake.in             |  15 +++
 cpp/src/gandiva/jni/CMakeLists.txt                 | 109 ---------------------
 docs/source/developers/java/building.rst           |  41 +++-----
 java/CMakeLists.txt                                |   4 +
 java/gandiva/CMakeLists.txt                        | 107 +++++++++++++-------
 java/gandiva/pom.xml                               |   2 +-
 {cpp/src => java}/gandiva/proto/Types.proto        |   0
 .../gandiva/src/main/cpp}/config_builder.cc        |   9 +-
 .../gandiva/src/main/cpp}/config_holder.cc         |   4 +-
 .../gandiva/src/main/cpp}/config_holder.h          |   2 +-
 .../jni => java/gandiva/src/main/cpp}/env_helper.h |   0
 .../src/main/cpp}/expression_registry_helper.cc    |  10 +-
 .../gandiva/src/main/cpp}/id_to_module_map.h       |   0
 .../gandiva/src/main/cpp}/jni_common.cc            |  22 ++---
 .../gandiva/src/main/cpp}/module_holder.h          |   2 +-
 .../jni => java/gandiva/src/main/cpp}/symbols.map  |   0
 java/pom.xml                                       |  98 +++---------------
 30 files changed, 160 insertions(+), 317 deletions(-)

diff --git a/ci/docker/fedora-35-cpp.dockerfile b/ci/docker/fedora-35-cpp.dockerfile
index 23844580b1..aeb7c5b795 100644
--- a/ci/docker/fedora-35-cpp.dockerfile
+++ b/ci/docker/fedora-35-cpp.dockerfile
@@ -80,7 +80,6 @@ ENV absl_SOURCE=BUNDLED \
     ARROW_DEPENDENCY_SOURCE=SYSTEM \
     ARROW_DATASET=ON \
     ARROW_FLIGHT=ON \
-    ARROW_GANDIVA_JAVA=ON \
     ARROW_GANDIVA=ON \
     ARROW_GCS=ON \
     ARROW_HOME=/usr/local \
diff --git a/ci/docker/java-jni-manylinux-201x.dockerfile b/ci/docker/java-jni-manylinux-201x.dockerfile
index c77ec63df7..3fdbfb7088 100644
--- a/ci/docker/java-jni-manylinux-201x.dockerfile
+++ b/ci/docker/java-jni-manylinux-201x.dockerfile
@@ -38,8 +38,7 @@ RUN yum install -y java-$java-openjdk-devel rh-maven35 && yum clean all
 ENV JAVA_HOME=/usr/lib/jvm/java-$java-openjdk/
 
 # For ci/scripts/{cpp,java}_*.sh
-ENV ARROW_GANDIVA_JAVA=ON \
-    ARROW_HOME=/tmp/local \
+ENV ARROW_HOME=/tmp/local \
     ARROW_JAVA_CDATA=ON \
     ARROW_JNI=ON \
     ARROW_PLASMA=ON \
diff --git a/ci/docker/linux-apt-jni.dockerfile b/ci/docker/linux-apt-jni.dockerfile
index 92b6cf9a9f..71826db048 100644
--- a/ci/docker/linux-apt-jni.dockerfile
+++ b/ci/docker/linux-apt-jni.dockerfile
@@ -73,7 +73,6 @@ ENV PATH=/opt/cmake-${cmake}-Linux-x86_64/bin:$PATH
 ENV ARROW_BUILD_TESTS=ON \
     ARROW_DATASET=ON \
     ARROW_FLIGHT=OFF \
-    ARROW_GANDIVA_JAVA=ON \
     ARROW_GANDIVA=ON \
     ARROW_HOME=/usr/local \
     ARROW_JAVA_CDATA=ON \
diff --git a/ci/scripts/cpp_build.sh b/ci/scripts/cpp_build.sh
index 5f29381fd1..9aea4af8fb 100755
--- a/ci/scripts/cpp_build.sh
+++ b/ci/scripts/cpp_build.sh
@@ -91,7 +91,6 @@ cmake \
   -DARROW_FLIGHT=${ARROW_FLIGHT:-OFF} \
   -DARROW_FLIGHT_SQL=${ARROW_FLIGHT_SQL:-OFF} \
   -DARROW_FUZZING=${ARROW_FUZZING:-OFF} \
-  -DARROW_GANDIVA_JAVA=${ARROW_GANDIVA_JAVA:-OFF} \
   -DARROW_GANDIVA_PC_CXX_FLAGS=${ARROW_GANDIVA_PC_CXX_FLAGS:-} \
   -DARROW_GANDIVA=${ARROW_GANDIVA:-OFF} \
   -DARROW_GCS=${ARROW_GCS:-OFF} \
diff --git a/ci/scripts/java_build.sh b/ci/scripts/java_build.sh
index ac252f55b3..220d979b7e 100755
--- a/ci/scripts/java_build.sh
+++ b/ci/scripts/java_build.sh
@@ -87,7 +87,7 @@ if [ "${ARROW_JAVA_CDATA}" = "ON" ]; then
   ${mvn} -Darrow.c.jni.dist.dir=${java_jni_dist_dir} -Parrow-c-data install
 fi
 
-if [ "${ARROW_GANDIVA_JAVA}" = "ON" ]; then
+if [ "${ARROW_JNI}" = "ON" ]; then
   ${mvn} -Darrow.cpp.build.dir=${java_jni_dist_dir} -Parrow-jni install
 fi
 
diff --git a/ci/scripts/java_jni_build.sh b/ci/scripts/java_jni_build.sh
index c68b52d77e..881cd47604 100755
--- a/ci/scripts/java_jni_build.sh
+++ b/ci/scripts/java_jni_build.sh
@@ -49,6 +49,7 @@ esac
 : ${CMAKE_BUILD_TYPE:=release}
 cmake \
   -DARROW_JAVA_JNI_ENABLE_DATASET=${ARROW_DATASET:-ON} \
+  -DARROW_JAVA_JNI_ENABLE_GANDIVA=${ARROW_GANDIVA:-ON} \
   -DBUILD_TESTING=${ARROW_JAVA_BUILD_TESTS} \
   -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
   -DCMAKE_PREFIX_PATH=${arrow_install_dir} \
diff --git a/ci/scripts/java_jni_macos_build.sh b/ci/scripts/java_jni_macos_build.sh
index 342bc2d118..dd15e79f57 100755
--- a/ci/scripts/java_jni_macos_build.sh
+++ b/ci/scripts/java_jni_macos_build.sh
@@ -33,7 +33,6 @@ install_dir=${build_dir}/cpp-install
 : ${ARROW_BUILD_TESTS:=ON}
 : ${ARROW_DATASET:=ON}
 : ${ARROW_FILESYSTEM:=ON}
-: ${ARROW_GANDIVA_JAVA:=ON}
 : ${ARROW_GANDIVA:=ON}
 : ${ARROW_ORC:=ON}
 : ${ARROW_PARQUET:=ON}
@@ -65,7 +64,6 @@ cmake \
   -DARROW_DEPENDENCY_USE_SHARED=OFF \
   -DARROW_FILESYSTEM=${ARROW_FILESYSTEM} \
   -DARROW_GANDIVA=${ARROW_GANDIVA} \
-  -DARROW_GANDIVA_JAVA=${ARROW_GANDIVA_JAVA} \
   -DARROW_GANDIVA_STATIC_LIBSTDCPP=ON \
   -DARROW_JNI=ON \
   -DARROW_ORC=${ARROW_ORC} \
@@ -117,7 +115,6 @@ fi
 echo "=== Copying libraries to the distribution folder ==="
 mkdir -p "${dist_dir}"
 cp -L ${install_dir}/lib/libarrow_orc_jni.dylib ${dist_dir}
-cp -L ${install_dir}/lib/libgandiva_jni.dylib ${dist_dir}
 cp -L ${build_dir}/cpp/*/libplasma_java.dylib ${dist_dir}
 
 echo "=== Checking shared dependencies for libraries ==="
diff --git a/ci/scripts/java_jni_manylinux_build.sh b/ci/scripts/java_jni_manylinux_build.sh
index 6669c4fdaa..5aca27e2a1 100755
--- a/ci/scripts/java_jni_manylinux_build.sh
+++ b/ci/scripts/java_jni_manylinux_build.sh
@@ -35,7 +35,6 @@ devtoolset_include_cpp="/opt/rh/devtoolset-${devtoolset_version}/root/usr/includ
 : ${ARROW_BUILD_TESTS:=ON}
 : ${ARROW_DATASET:=ON}
 : ${ARROW_GANDIVA:=ON}
-: ${ARROW_GANDIVA_JAVA:=ON}
 : ${ARROW_FILESYSTEM:=ON}
 : ${ARROW_JEMALLOC:=ON}
 : ${ARROW_RPATH_ORIGIN:=ON}
@@ -73,7 +72,6 @@ cmake \
   -DARROW_DEPENDENCY_SOURCE="VCPKG" \
   -DARROW_DEPENDENCY_USE_SHARED=OFF \
   -DARROW_FILESYSTEM=${ARROW_FILESYSTEM} \
-  -DARROW_GANDIVA_JAVA=${ARROW_GANDIVA_JAVA} \
   -DARROW_GANDIVA_PC_CXX_FLAGS=${GANDIVA_CXX_FLAGS} \
   -DARROW_GANDIVA=${ARROW_GANDIVA} \
   -DARROW_JEMALLOC=${ARROW_JEMALLOC} \
@@ -137,7 +135,6 @@ fi
 
 echo "=== Copying libraries to the distribution folder ==="
 cp -L ${ARROW_HOME}/lib/libarrow_orc_jni.so ${dist_dir}
-cp -L ${ARROW_HOME}/lib/libgandiva_jni.so ${dist_dir}
 cp -L ${build_dir}/cpp/*/libplasma_java.so ${dist_dir}
 
 echo "=== Checking shared dependencies for libraries ==="
diff --git a/cpp/build-support/lint_exclusions.txt b/cpp/build-support/lint_exclusions.txt
index 73cbd884f4..195c3dee36 100644
--- a/cpp/build-support/lint_exclusions.txt
+++ b/cpp/build-support/lint_exclusions.txt
@@ -1,5 +1,7 @@
-*_generated*
 *.grpc.fb.*
+*.pb.*
+*RcppExports.cpp*
+*_generated*
 *arrowExports.cpp*
 *parquet_constants.*
 *parquet_types.*
@@ -7,7 +9,6 @@
 *pyarrow_lib.h
 *python/config.h
 *python/platform.h
-*RcppExports.cpp*
 *thirdparty/*
 *vendored/*
 *windows_compatibility.h
diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake
index ffa1b13c90..34ee8f3456 100644
--- a/cpp/cmake_modules/DefineOptions.cmake
+++ b/cpp/cmake_modules/DefineOptions.cmake
@@ -470,8 +470,6 @@ Always OFF if building binaries" OFF)
   #----------------------------------------------------------------------
   set_option_category("Gandiva")
 
-  define_option(ARROW_GANDIVA_JAVA "Build the Gandiva JNI wrappers" OFF)
-
   # ARROW-3860: Temporary workaround
   define_option(ARROW_GANDIVA_STATIC_LIBSTDCPP
                 "Include -static-libstdc++ -static-libgcc when linking with;Gandiva static libraries"
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index a45ae61015..5d1e50ffa2 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -210,11 +210,13 @@ endmacro()
 
 # Find modules are needed by the consumer in case of a static build, or if the
 # linkage is PUBLIC or INTERFACE.
-macro(provide_find_module PACKAGE_NAME)
+macro(provide_find_module PACKAGE_NAME ARROW_CMAKE_PACKAGE_NAME)
   set(module_ "${CMAKE_SOURCE_DIR}/cmake_modules/Find${PACKAGE_NAME}.cmake")
   if(EXISTS "${module_}")
-    message(STATUS "Providing CMake module for ${PACKAGE_NAME}")
-    install(FILES "${module_}" DESTINATION "${ARROW_CMAKE_DIR}/Arrow")
+    message(STATUS "Providing CMake module for ${PACKAGE_NAME} as part of ${ARROW_CMAKE_PACKAGE_NAME} CMake package"
+    )
+    install(FILES "${module_}"
+            DESTINATION "${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}")
   endif()
   unset(module_)
 endmacro()
@@ -283,7 +285,7 @@ macro(resolve_dependency DEPENDENCY_NAME)
     endif()
   endif()
   if(${DEPENDENCY_NAME}_SOURCE STREQUAL "SYSTEM" AND ARG_IS_RUNTIME_DEPENDENCY)
-    provide_find_module(${PACKAGE_NAME})
+    provide_find_module(${PACKAGE_NAME} "Arrow")
     list(APPEND ARROW_SYSTEM_DEPENDENCIES ${PACKAGE_NAME})
     find_package(PkgConfig QUIET)
     foreach(ARG_PC_PACKAGE_NAME ${ARG_PC_PACKAGE_NAMES})
diff --git a/cpp/src/arrow/ArrowConfig.cmake.in b/cpp/src/arrow/ArrowConfig.cmake.in
index 8386bcd728..b2ee43707b 100644
--- a/cpp/src/arrow/ArrowConfig.cmake.in
+++ b/cpp/src/arrow/ArrowConfig.cmake.in
@@ -37,8 +37,6 @@ set(ARROW_FULL_SO_VERSION "@ARROW_FULL_SO_VERSION@")
 set(ARROW_BUNDLED_STATIC_LIBS "@ARROW_BUNDLED_STATIC_LIBS@")
 set(ARROW_INCLUDE_PATH_SUFFIXES "@ARROW_INCLUDE_PATH_SUFFIXES@")
 set(ARROW_LIBRARY_PATH_SUFFIXES "@ARROW_LIBRARY_PATH_SUFFIXES@")
-set(ARROW_LLVM_VERSIONS "@ARROW_LLVM_VERSIONS@")
-set(ARROW_LLVM_VERSION_PRIMARY_MAJOR "@ARROW_LLVM_VERSION_PRIMARY_MAJOR@")
 set(ARROW_SYSTEM_DEPENDENCIES "@ARROW_SYSTEM_DEPENDENCIES@")
 
 include("${CMAKE_CURRENT_LIST_DIR}/ArrowOptions.cmake")
@@ -51,7 +49,9 @@ if(ARROW_BUILD_STATIC)
   find_dependency(Threads)
 
   if(DEFINED CMAKE_MODULE_PATH)
-    set(_CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH})
+    set(ARROW_CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH})
+  else()
+    unset(ARROW_CMAKE_MODULE_PATH_OLD)
   endif()
   set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
 
@@ -84,9 +84,9 @@ if(ARROW_BUILD_STATIC)
     endif()
   endforeach()
 
-  if(DEFINED _CMAKE_MODULE_PATH_OLD)
-    set(CMAKE_MODULE_PATH ${_CMAKE_MODULE_PATH_OLD})
-    unset(_CMAKE_MODULE_PATH_OLD)
+  if(DEFINED ARROW_CMAKE_MODULE_PATH_OLD)
+    set(CMAKE_MODULE_PATH ${ARROW_CMAKE_MODULE_PATH_OLD})
+    unset(ARROW_CMAKE_MODULE_PATH_OLD)
   else()
     unset(CMAKE_MODULE_PATH)
   endif()
diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt
index 12e8b301f4..312ab84f65 100644
--- a/cpp/src/gandiva/CMakeLists.txt
+++ b/cpp/src/gandiva/CMakeLists.txt
@@ -26,6 +26,7 @@ add_custom_target(gandiva-benchmarks)
 add_dependencies(gandiva-all gandiva gandiva-tests gandiva-benchmarks)
 
 find_package(LLVMAlt REQUIRED)
+provide_find_module(LLVMAlt "Gandiva")
 
 add_definitions(-DGANDIVA_LLVM_VERSION=${LLVM_VERSION_MAJOR})
 
@@ -155,7 +156,8 @@ add_arrow_lib(gandiva
               ${GANDIVA_STATIC_LINK_LIBS}
               STATIC_INSTALL_INTERFACE_LIBS
               Arrow::arrow_static
-              LLVM::LLVM_HEADERS)
+              LLVM::LLVM_HEADERS
+              LLVM::LLVM_LIBS)
 
 foreach(LIB_TARGET ${GANDIVA_LIBRARIES})
   target_compile_definitions(${LIB_TARGET} PRIVATE GANDIVA_EXPORTING)
@@ -246,9 +248,5 @@ add_gandiva_test(internals-test
                  gdv_function_stubs_test.cc
                  interval_holder_test.cc)
 
-if(ARROW_GANDIVA_JAVA)
-  add_subdirectory(jni)
-endif()
-
 add_subdirectory(precompiled)
 add_subdirectory(tests)
diff --git a/cpp/src/gandiva/GandivaConfig.cmake.in b/cpp/src/gandiva/GandivaConfig.cmake.in
index c6d7cef73d..20cdc75acb 100644
--- a/cpp/src/gandiva/GandivaConfig.cmake.in
+++ b/cpp/src/gandiva/GandivaConfig.cmake.in
@@ -26,9 +26,24 @@
 
 @PACKAGE_INIT@
 
+set(ARROW_LLVM_VERSIONS "@ARROW_LLVM_VERSIONS@")
+set(ARROW_LLVM_VERSION_PRIMARY_MAJOR "@ARROW_LLVM_VERSION_PRIMARY_MAJOR@")
+
 include(CMakeFindDependencyMacro)
 find_dependency(Arrow)
+if(DEFINED CMAKE_MODULE_PATH)
+  set(GANDIVA_CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH})
+else()
+  unset(GANDIVA_CMAKE_MODULE_PATH_OLD)
+endif()
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
 find_dependency(LLVMAlt)
+if(DEFINED GANDIVA_CMAKE_MODULE_PATH_OLD)
+  set(CMAKE_MODULE_PATH ${GANDIVA_CMAKE_MODULE_PATH_OLD})
+  unset(GANDIVA_CMAKE_MODULE_PATH_OLD)
+else()
+  unset(CMAKE_MODULE_PATH)
+endif()
 
 include("${CMAKE_CURRENT_LIST_DIR}/GandivaTargets.cmake")
 
diff --git a/cpp/src/gandiva/jni/CMakeLists.txt b/cpp/src/gandiva/jni/CMakeLists.txt
deleted file mode 100644
index b89356121d..0000000000
--- a/cpp/src/gandiva/jni/CMakeLists.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-if(CMAKE_VERSION VERSION_LESS 3.11)
-  message(FATAL_ERROR "Building the Gandiva JNI bindings requires CMake version >= 3.11")
-endif()
-
-if(MSVC)
-  add_definitions(-DPROTOBUF_USE_DLLS)
-endif()
-
-# Find JNI
-find_package(JNI REQUIRED)
-
-set(PROTO_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
-set(PROTO_OUTPUT_FILES "${PROTO_OUTPUT_DIR}/Types.pb.cc")
-set(PROTO_OUTPUT_FILES ${PROTO_OUTPUT_FILES} "${PROTO_OUTPUT_DIR}/Types.pb.h")
-
-set_source_files_properties(${PROTO_OUTPUT_FILES} PROPERTIES GENERATED TRUE)
-
-get_filename_component(ABS_GANDIVA_PROTO
-                       ${CMAKE_SOURCE_DIR}/src/gandiva/proto/Types.proto ABSOLUTE)
-
-add_custom_command(OUTPUT ${PROTO_OUTPUT_FILES}
-                   COMMAND ${ARROW_PROTOBUF_PROTOC} --proto_path
-                           ${CMAKE_SOURCE_DIR}/src/gandiva/proto --cpp_out
-                           ${PROTO_OUTPUT_DIR}
-                           ${CMAKE_SOURCE_DIR}/src/gandiva/proto/Types.proto
-                   DEPENDS ${ABS_GANDIVA_PROTO} ${ARROW_PROTOBUF_LIBPROTOBUF}
-                   COMMENT "Running PROTO compiler on Types.proto"
-                   VERBATIM)
-
-add_custom_target(gandiva_jni_proto ALL DEPENDS ${PROTO_OUTPUT_FILES})
-set(PROTO_SRCS "${PROTO_OUTPUT_DIR}/Types.pb.cc")
-set(PROTO_HDRS "${PROTO_OUTPUT_DIR}/Types.pb.h")
-
-# Create the jni header file (from the java class).
-set(JNI_HEADERS_DIR "${CMAKE_CURRENT_BINARY_DIR}/java")
-add_subdirectory(../../../../java/gandiva ./java/gandiva)
-
-set(GANDIVA_LINK_LIBS ${ARROW_PROTOBUF_LIBPROTOBUF})
-if(ARROW_BUILD_STATIC)
-  list(APPEND GANDIVA_LINK_LIBS gandiva_static)
-else()
-  list(APPEND GANDIVA_LINK_LIBS gandiva_shared)
-endif()
-
-set(GANDIVA_JNI_SOURCES
-    config_builder.cc
-    config_holder.cc
-    expression_registry_helper.cc
-    jni_common.cc
-    ${PROTO_SRCS})
-
-# For users of gandiva_jni library (including integ tests), include-dir is :
-#   /usr/**/include dir after install,
-#   cpp/include during build
-# For building gandiva_jni library itself, include-dir (in addition to above) is :
-#   cpp/src
-add_arrow_lib(gandiva_jni
-              SOURCES
-              ${GANDIVA_JNI_SOURCES}
-              OUTPUTS
-              GANDIVA_JNI_LIBRARIES
-              BUILD_SHARED
-              ON
-              BUILD_STATIC
-              OFF
-              SHARED_LINK_LIBS
-              ${GANDIVA_LINK_LIBS}
-              DEPENDENCIES
-              ${GANDIVA_LINK_LIBS}
-              gandiva_java
-              gandiva_jni_headers
-              gandiva_jni_proto
-              EXTRA_INCLUDES
-              $<INSTALL_INTERFACE:include>
-              $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
-              $<BUILD_INTERFACE:${JNI_HEADERS_DIR}>
-              PRIVATE_INCLUDES
-              ${JNI_INCLUDE_DIRS}
-              ${CMAKE_CURRENT_BINARY_DIR})
-
-add_dependencies(gandiva ${GANDIVA_JNI_LIBRARIES})
-
-if(ARROW_BUILD_SHARED)
-  # filter out everything that is not needed for the jni bridge
-  # statically linked stdc++ has conflicts with stdc++ loaded by other libraries.
-  if(CXX_LINKER_SUPPORTS_VERSION_SCRIPT)
-    set_target_properties(gandiva_jni_shared
-                          PROPERTIES LINK_FLAGS
-                                     "-Wl,--version-script=${CMAKE_SOURCE_DIR}/src/gandiva/jni/symbols.map"
-    )
-  endif()
-endif()
diff --git a/docs/source/developers/java/building.rst b/docs/source/developers/java/building.rst
index 42faadb8d2..846277faa3 100644
--- a/docs/source/developers/java/building.rst
+++ b/docs/source/developers/java/building.rst
@@ -111,28 +111,19 @@ Maven
         $ ls -latr ../java-dist/lib
         |__ libarrow_cdata_jni.dylib
 
-- To build JNI ORC & JNI Gandiva libraries:
+- To build all JNI libraries except the JNI C Data Interface library:
 
     .. code-block::
 
         $ cd arrow/java
         $ export JAVA_HOME=<absolute path to your java home>
         $ java --version
-        $ mvn clean generate-resources -Pgenerate-jnicpp-dylib_so -N
-        $ ls -latr  java-dist/lib
-        |__ libarrow_orc_jni.dylib
-        |__ libgandiva_jni.dylib
-
-- To build only the JNI Dataset library:
-
-    .. code-block::
-
-        $ cd arrow/java
-        $ export JAVA_HOME=<absolute path to your java home>
-        $ java --version
-        $ mvn clean generate-resources -Pgenerate-dataset-dylib_so -N
+        $ mvn clean generate-resources -Pgenerate-jni-dylib_so -N
         $ ls -latr java-dist/lib
         |__ libarrow_dataset_jni.dylib
+        |__ libarrow_orc_jni.dylib
+        |__ libgandiva_jni.dylib
+        |__ libplasma_java.dylib
 
 CMake
 ~~~~~
@@ -142,7 +133,7 @@ CMake
     .. code-block::
 
         $ cd arrow
-        $ mkdir -p java-dist java-jni
+        $ mkdir -p java-dist java-cdata
         $ cmake \
             -S java \
             -B java-jni \
@@ -155,7 +146,7 @@ CMake
         $ ls -latr java-dist/lib
         |__ libarrow_cdata_jni.dylib
 
-- To build JNI ORC & Gandiva libraries:
+- To build all JNI libraries except the JNI C Data Interface library:
 
     .. code-block::
 
@@ -176,7 +167,6 @@ CMake
             -DARROW_DEPENDENCY_USE_SHARED=OFF \
             -DARROW_FILESYSTEM=ON \
             -DARROW_GANDIVA=ON \
-            -DARROW_GANDIVA_JAVA=ON \
             -DARROW_GANDIVA_STATIC_LIBSTDCPP=ON \
             -DARROW_JNI=ON \
             -DARROW_ORC=ON \
@@ -190,21 +180,11 @@ CMake
             -DCMAKE_INSTALL_PREFIX=java-dist \
             -DCMAKE_UNITY_BUILD=ON
         $ cmake --build cpp-jni --target install --config Release
-        $ ls -latr  java-dist/lib
-        |__ libarrow_orc_jni.dylib
-        |__ libgandiva_jni.dylib
-
-- To build only the JNI Dataset library:
-
-    .. code-block::
-
-        $ cd arrow
-        $ mkdir -p java-dist java-jni
         $ cmake \
             -S java \
             -B java-jni \
-            -DARROW_JAVA_JNI_ENABLE_DATASET=ON \
-            -DARROW_JAVA_JNI_ENABLE_DEFAULT=OFF \
+            -DARROW_JAVA_JNI_ENABLE_C=OFF \
+            -DARROW_JAVA_JNI_ENABLE_DEFAULT=ON \
             -DBUILD_TESTING=OFF \
             -DCMAKE_BUILD_TYPE=Release \
             -DCMAKE_INSTALL_PREFIX=java-dist/lib \
@@ -212,6 +192,9 @@ CMake
         $ cmake --build java-jni --target install --config Release
         $ ls -latr java-dist/lib
         |__ libarrow_dataset_jni.dylib
+        |__ libarrow_orc_jni.dylib
+        |__ libgandiva_jni.dylib
+        |__ libplasma_java.dylib
 
 Archery
 ~~~~~~~
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
index 4778f030c2..69e3f3940d 100644
--- a/java/CMakeLists.txt
+++ b/java/CMakeLists.txt
@@ -29,6 +29,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
 option(ARROW_JAVA_JNI_ENABLE_DEFAULT "Whether enable components by default or not" ON)
 option(ARROW_JAVA_JNI_ENABLE_C "Enable C data interface" ${ARROW_JAVA_JNI_ENABLE_DEFAULT})
 option(ARROW_JAVA_JNI_ENABLE_DATASET "Enable dataset" ${ARROW_JAVA_JNI_ENABLE_DEFAULT})
+option(ARROW_JAVA_JNI_ENABLE_GANDIVA "Enable Gandiva" ${ARROW_JAVA_JNI_ENABLE_DEFAULT})
 
 # ccache
 option(ARROW_JAVA_JNI_USE_CCACHE "Use ccache when compiling (if available)" ON)
@@ -70,3 +71,6 @@ endif()
 if(ARROW_JAVA_JNI_ENABLE_DATASET)
   add_subdirectory(dataset)
 endif()
+if(ARROW_JAVA_JNI_ENABLE_GANDIVA)
+  add_subdirectory(gandiva)
+endif()
diff --git a/java/gandiva/CMakeLists.txt b/java/gandiva/CMakeLists.txt
index 5010daf799..805253da92 100644
--- a/java/gandiva/CMakeLists.txt
+++ b/java/gandiva/CMakeLists.txt
@@ -15,41 +15,76 @@
 # specific language governing permissions and limitations
 # under the License.
 
-project(gandiva_java)
-
-# Find java/jni
-include(FindJava)
-include(UseJava)
-include(FindJNI)
-
-message("generating headers to ${JNI_HEADERS_DIR}/jni")
-
-# generate_native_headers is available only from java8
-# centos5 does not have java8 images, so supporting java 7 too.
-# unfortunately create_javah does not work in java8 correctly.
-if(ARROW_GANDIVA_JAVA7)
-  add_jar(gandiva_java
-          src/main/java/org/apache/arrow/gandiva/evaluator/ConfigurationBuilder.java
-          src/main/java/org/apache/arrow/gandiva/evaluator/JniWrapper.java
-          src/main/java/org/apache/arrow/gandiva/evaluator/ExpressionRegistryJniHelper.java
-          src/main/java/org/apache/arrow/gandiva/exceptions/GandivaException.java)
-
-  create_javah(TARGET gandiva_jni_headers
-               CLASSES org.apache.arrow.gandiva.evaluator.ConfigurationBuilder
-                       org.apache.arrow.gandiva.evaluator.JniWrapper
-                       org.apache.arrow.gandiva.evaluator.ExpressionRegistryJniHelper
-                       org.apache.arrow.gandiva.exceptions.GandivaException
-               DEPENDS gandiva_java
-               CLASSPATH gandiva_java
-               OUTPUT_DIR ${JNI_HEADERS_DIR}/jni)
+find_package(Gandiva REQUIRED)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
+                    ${JNI_INCLUDE_DIRS} ${JNI_HEADERS_DIR})
+
+add_jar(arrow_java_jni_gandiva_jar
+        src/main/java/org/apache/arrow/gandiva/evaluator/ConfigurationBuilder.java
+        src/main/java/org/apache/arrow/gandiva/evaluator/JniWrapper.java
+        src/main/java/org/apache/arrow/gandiva/evaluator/ExpressionRegistryJniHelper.java
+        src/main/java/org/apache/arrow/gandiva/exceptions/GandivaException.java
+        GENERATE_NATIVE_HEADERS
+        arrow_java_jni_gandiva_headers)
+
+set(GANDIVA_PROTO_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
+set(GANDIVA_PROTO_OUTPUT_FILES "${GANDIVA_PROTO_OUTPUT_DIR}/Types.pb.cc"
+                               "${GANDIVA_PROTO_OUTPUT_DIR}/Types.pb.h")
+
+set_source_files_properties(${GANDIVA_PROTO_OUTPUT_FILES} PROPERTIES GENERATED TRUE)
+
+set(GANDIVA_PROTO_DIR ${CMAKE_CURRENT_SOURCE_DIR}/proto)
+get_filename_component(GANDIVA_PROTO_FILE_ABSOLUTE ${GANDIVA_PROTO_DIR}/Types.proto
+                       ABSOLUTE)
+
+find_package(Protobuf REQUIRED)
+if(MSVC)
+  add_definitions(-DPROTOBUF_USE_DLLS)
+endif()
+add_custom_command(OUTPUT ${GANDIVA_PROTO_OUTPUT_FILES}
+                   COMMAND protobuf::protoc --proto_path ${GANDIVA_PROTO_DIR} --cpp_out
+                           ${GANDIVA_PROTO_OUTPUT_DIR} ${GANDIVA_PROTO_FILE_ABSOLUTE}
+                   DEPENDS ${GANDIVA_PROTO_FILE_ABSOLUTE}
+                   COMMENT "Running Protobuf compiler on Types.proto"
+                   VERBATIM)
+
+add_custom_target(garrow_java_jni_gandiva_proto ALL DEPENDS ${GANDIVA_PROTO_OUTPUT_FILES})
+add_library(arrow_java_jni_gandiva SHARED
+            src/main/cpp/config_builder.cc
+            src/main/cpp/config_holder.cc
+            src/main/cpp/expression_registry_helper.cc
+            src/main/cpp/jni_common.cc
+            ${GANDIVA_PROTO_OUTPUT_FILES})
+set_property(TARGET arrow_java_jni_gandiva PROPERTY OUTPUT_NAME "gandiva_jni")
+target_link_libraries(arrow_java_jni_gandiva
+                      arrow_java_jni_gandiva_headers
+                      jni
+                      protobuf::libprotobuf
+                      Gandiva::gandiva_static)
+
+# Localize thirdparty symbols using a linker version script. This hides them
+# from the client application. The OS X linker does not support the
+# version-script option.
+if(CMAKE_VERSION VERSION_LESS 3.18)
+  if(APPLE OR WIN32)
+    set(CXX_LINKER_SUPPORTS_VERSION_SCRIPT FALSE)
+  else()
+    set(CXX_LINKER_SUPPORTS_VERSION_SCRIPT TRUE)
+  endif()
 else()
-  add_jar(gandiva_java
-          src/main/java/org/apache/arrow/gandiva/evaluator/ConfigurationBuilder.java
-          src/main/java/org/apache/arrow/gandiva/evaluator/JniWrapper.java
-          src/main/java/org/apache/arrow/gandiva/evaluator/ExpressionRegistryJniHelper.java
-          src/main/java/org/apache/arrow/gandiva/exceptions/GandivaException.java
-          GENERATE_NATIVE_HEADERS
-          gandiva_jni_headers
-          DESTINATION
-          ${JNI_HEADERS_DIR}/jni)
+  include(CheckLinkerFlag)
+  check_linker_flag(CXX
+                    "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/symbols.map"
+                    CXX_LINKER_SUPPORTS_VERSION_SCRIPT)
 endif()
+# filter out everything that is not needed for the jni bridge
+# statically linked stdc++ has conflicts with stdc++ loaded by other libraries.
+if(CXX_LINKER_SUPPORTS_VERSION_SCRIPT)
+  set_target_properties(arrow_java_jni_gandiva
+                        PROPERTIES LINK_FLAGS
+                                   "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/symbols.map"
+  )
+endif()
+
+install(TARGETS arrow_java_jni_gandiva DESTINATION ${CMAKE_INSTALL_PREFIX})
diff --git a/java/gandiva/pom.xml b/java/gandiva/pom.xml
index 3c6ba7b12c..60c9dc8f35 100644
--- a/java/gandiva/pom.xml
+++ b/java/gandiva/pom.xml
@@ -136,7 +136,7 @@
                 <configuration>
                     <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}
                     </protocArtifact>
-                    <protoSourceRoot>../../cpp/src/gandiva/proto</protoSourceRoot>
+                    <protoSourceRoot>proto</protoSourceRoot>
                 </configuration>
                 <executions>
                     <execution>
diff --git a/cpp/src/gandiva/proto/Types.proto b/java/gandiva/proto/Types.proto
similarity index 100%
rename from cpp/src/gandiva/proto/Types.proto
rename to java/gandiva/proto/Types.proto
diff --git a/cpp/src/gandiva/jni/config_builder.cc b/java/gandiva/src/main/cpp/config_builder.cc
similarity index 90%
rename from cpp/src/gandiva/jni/config_builder.cc
rename to java/gandiva/src/main/cpp/config_builder.cc
index b115210cef..85c661ee94 100644
--- a/cpp/src/gandiva/jni/config_builder.cc
+++ b/java/gandiva/src/main/cpp/config_builder.cc
@@ -17,10 +17,11 @@
 
 #include <string>
 
-#include "gandiva/configuration.h"
-#include "gandiva/jni/config_holder.h"
-#include "gandiva/jni/env_helper.h"
-#include "jni/org_apache_arrow_gandiva_evaluator_ConfigurationBuilder.h"
+#include <gandiva/configuration.h>
+
+#include "config_holder.h"
+#include "env_helper.h"
+#include "org_apache_arrow_gandiva_evaluator_ConfigurationBuilder.h"
 
 using gandiva::ConfigHolder;
 using gandiva::Configuration;
diff --git a/cpp/src/gandiva/jni/config_holder.cc b/java/gandiva/src/main/cpp/config_holder.cc
similarity index 96%
rename from cpp/src/gandiva/jni/config_holder.cc
rename to java/gandiva/src/main/cpp/config_holder.cc
index 11d305c819..dfa6afce19 100644
--- a/cpp/src/gandiva/jni/config_holder.cc
+++ b/java/gandiva/src/main/cpp/config_holder.cc
@@ -15,10 +15,10 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include "gandiva/jni/config_holder.h"
-
 #include <cstdint>
 
+#include "config_holder.h"
+
 namespace gandiva {
 int64_t ConfigHolder::config_id_ = 1;
 
diff --git a/cpp/src/gandiva/jni/config_holder.h b/java/gandiva/src/main/cpp/config_holder.h
similarity index 98%
rename from cpp/src/gandiva/jni/config_holder.h
rename to java/gandiva/src/main/cpp/config_holder.h
index 3fdb7a01d5..ae031495ab 100644
--- a/cpp/src/gandiva/jni/config_holder.h
+++ b/java/gandiva/src/main/cpp/config_holder.h
@@ -22,7 +22,7 @@
 #include <unordered_map>
 #include <utility>
 
-#include "gandiva/configuration.h"
+#include <gandiva/configuration.h>
 
 namespace gandiva {
 
diff --git a/cpp/src/gandiva/jni/env_helper.h b/java/gandiva/src/main/cpp/env_helper.h
similarity index 100%
rename from cpp/src/gandiva/jni/env_helper.h
rename to java/gandiva/src/main/cpp/env_helper.h
diff --git a/cpp/src/gandiva/jni/expression_registry_helper.cc b/java/gandiva/src/main/cpp/expression_registry_helper.cc
similarity index 97%
rename from cpp/src/gandiva/jni/expression_registry_helper.cc
rename to java/gandiva/src/main/cpp/expression_registry_helper.cc
index 338290618d..6765df3b97 100644
--- a/cpp/src/gandiva/jni/expression_registry_helper.cc
+++ b/java/gandiva/src/main/cpp/expression_registry_helper.cc
@@ -15,14 +15,14 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include "jni/org_apache_arrow_gandiva_evaluator_ExpressionRegistryJniHelper.h"
-
 #include <memory>
 
+#include <arrow/util/logging.h>
+#include <gandiva/arrow.h>
+#include <gandiva/expression_registry.h>
+
 #include "Types.pb.h"
-#include "arrow/util/logging.h"
-#include "gandiva/arrow.h"
-#include "gandiva/expression_registry.h"
+#include "org_apache_arrow_gandiva_evaluator_ExpressionRegistryJniHelper.h"
 
 using gandiva::DataTypePtr;
 using gandiva::ExpressionRegistry;
diff --git a/cpp/src/gandiva/jni/id_to_module_map.h b/java/gandiva/src/main/cpp/id_to_module_map.h
similarity index 100%
rename from cpp/src/gandiva/jni/id_to_module_map.h
rename to java/gandiva/src/main/cpp/id_to_module_map.h
diff --git a/cpp/src/gandiva/jni/jni_common.cc b/java/gandiva/src/main/cpp/jni_common.cc
similarity index 98%
rename from cpp/src/gandiva/jni/jni_common.cc
rename to java/gandiva/src/main/cpp/jni_common.cc
index 3940b9c81a..ba0af1106b 100644
--- a/cpp/src/gandiva/jni/jni_common.cc
+++ b/java/gandiva/src/main/cpp/jni_common.cc
@@ -28,19 +28,19 @@
 #include <arrow/builder.h>
 #include <arrow/record_batch.h>
 #include <arrow/type.h>
+#include <gandiva/configuration.h>
+#include <gandiva/decimal_scalar.h>
+#include <gandiva/filter.h>
+#include <gandiva/projector.h>
+#include <gandiva/selection_vector.h>
+#include <gandiva/tree_expr_builder.h>
 
 #include "Types.pb.h"
-#include "gandiva/configuration.h"
-#include "gandiva/decimal_scalar.h"
-#include "gandiva/filter.h"
-#include "gandiva/jni/config_holder.h"
-#include "gandiva/jni/env_helper.h"
-#include "gandiva/jni/id_to_module_map.h"
-#include "gandiva/jni/module_holder.h"
-#include "gandiva/projector.h"
-#include "gandiva/selection_vector.h"
-#include "gandiva/tree_expr_builder.h"
-#include "jni/org_apache_arrow_gandiva_evaluator_JniWrapper.h"
+#include "config_holder.h"
+#include "env_helper.h"
+#include "id_to_module_map.h"
+#include "module_holder.h"
+#include "org_apache_arrow_gandiva_evaluator_JniWrapper.h"
 
 using gandiva::ConditionPtr;
 using gandiva::DataTypePtr;
diff --git a/cpp/src/gandiva/jni/module_holder.h b/java/gandiva/src/main/cpp/module_holder.h
similarity index 98%
rename from cpp/src/gandiva/jni/module_holder.h
rename to java/gandiva/src/main/cpp/module_holder.h
index 929c64231f..74bad29e68 100644
--- a/cpp/src/gandiva/jni/module_holder.h
+++ b/java/gandiva/src/main/cpp/module_holder.h
@@ -20,7 +20,7 @@
 #include <memory>
 #include <utility>
 
-#include "gandiva/arrow.h"
+#include <gandiva/arrow.h>
 
 namespace gandiva {
 
diff --git a/cpp/src/gandiva/jni/symbols.map b/java/gandiva/src/main/cpp/symbols.map
similarity index 100%
rename from cpp/src/gandiva/jni/symbols.map
rename to java/gandiva/src/main/cpp/symbols.map
diff --git a/java/pom.xml b/java/pom.xml
index ea5c46334a..b5db145cc5 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -930,7 +930,7 @@
             <version>3.1.0</version>
             <executions>
               <execution>
-                <id>cdatadir</id>
+                <id>cdata-dir</id>
                 <phase>generate-resources</phase>
                 <goals>
                   <goal>exec</goal>
@@ -942,7 +942,7 @@
                 </configuration>
               </execution>
               <execution>
-                <id>cdatadefine</id>
+                <id>cdata-cmake</id>
                 <phase>generate-resources</phase>
                 <goals>
                   <goal>exec</goal>
@@ -962,7 +962,7 @@
                 </configuration>
               </execution>
               <execution>
-                <id>cdatabuild</id>
+                <id>cdata-build</id>
                 <phase>generate-resources</phase>
                 <goals>
                   <goal>exec</goal>
@@ -982,7 +982,7 @@
     </profile>
 
     <profile>
-      <id>generate-dataset-dylib_so</id>
+      <id>generate-jni-dylib_so</id>
       <properties>
         <arrow.dataset.jni.dist.dir>java-dist/lib</arrow.dataset.jni.dist.dir>
         <cpp.dependencies.builded>false</cpp.dependencies.builded>
@@ -995,7 +995,7 @@
             <version>3.1.0</version>
             <executions>
               <execution>
-                <id>datasetdir</id>
+                <id>jni-dir</id>
                 <phase>generate-resources</phase>
                 <goals>
                   <goal>exec</goal>
@@ -1007,7 +1007,7 @@
                 </configuration>
               </execution>
               <execution>
-                <id>datasetarrowdependency</id>
+                <id>jni-cpp-cmake</id>
                 <phase>generate-resources</phase>
                 <goals>
                   <goal>exec</goal>
@@ -1023,7 +1023,6 @@
                     -DARROW_DEPENDENCY_USE_SHARED=OFF
                     -DARROW_FILESYSTEM=ON
                     -DARROW_GANDIVA=ON
-                    -DARROW_GANDIVA_JAVA=ON
                     -DARROW_GANDIVA_STATIC_LIBSTDCPP=ON
                     -DARROW_JNI=ON
                     -DARROW_ORC=ON
@@ -1042,7 +1041,7 @@
                 </configuration>
               </execution>
               <execution>
-                <id>datasetarrowdependencybuild</id>
+                <id>jni-cpp-build</id>
                 <phase>generate-resources</phase>
                 <goals>
                   <goal>exec</goal>
@@ -1057,7 +1056,7 @@
                 </configuration>
               </execution>
               <execution>
-                <id>datasetdefine</id>
+                <id>jni-cmake</id>
                 <phase>generate-resources</phase>
                 <goals>
                   <goal>exec</goal>
@@ -1067,8 +1066,8 @@
                   <commandlineArgs>
                     -S java
                     -B java-jni
-                    -DARROW_JAVA_JNI_ENABLE_DATASET=ON
-                    -DARROW_JAVA_JNI_ENABLE_DEFAULT=OFF
+                    -DARROW_JAVA_JNI_ENABLE_C=OFF
+                    -DARROW_JAVA_JNI_ENABLE_DEFAULT=ON
                     -DBUILD_TESTING=OFF
                     -DCMAKE_BUILD_TYPE=Release
                     -DCMAKE_INSTALL_PREFIX=${arrow.c.jni.dist.dir}
@@ -1078,7 +1077,7 @@
                 </configuration>
               </execution>
               <execution>
-                <id>datasetbuild</id>
+                <id>jni-build</id>
                 <phase>generate-resources</phase>
                 <goals>
                   <goal>exec</goal>
@@ -1097,81 +1096,6 @@
       </build>
     </profile>
 
-    <profile>
-      <id>generate-jnicpp-dylib_so</id>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.codehaus.mojo</groupId>
-            <artifactId>exec-maven-plugin</artifactId>
-            <version>3.1.0</version>
-            <executions>
-              <execution>
-                <id>jnidir</id>
-                <phase>generate-resources</phase>
-                <goals>
-                  <goal>exec</goal>
-                </goals>
-                <configuration>
-                  <executable>mkdir</executable>
-                  <commandlineArgs>-p java-dist cpp-jni</commandlineArgs>
-                  <workingDirectory>../</workingDirectory>
-                </configuration>
-              </execution>
-              <execution>
-                <id>jnidefine</id>
-                <phase>generate-resources</phase>
-                <goals>
-                  <goal>exec</goal>
-                </goals>
-                <configuration>
-                  <executable>cmake</executable>
-                  <commandlineArgs>
-                    -S cpp
-                    -B cpp-jni
-                    -DARROW_CSV=ON
-                    -DARROW_DATASET=ON
-                    -DARROW_DEPENDENCY_SOURCE=BUNDLED
-                    -DARROW_DEPENDENCY_USE_SHARED=OFF
-                    -DARROW_FILESYSTEM=ON
-                    -DARROW_GANDIVA=ON
-                    -DARROW_GANDIVA_JAVA=ON
-                    -DARROW_GANDIVA_STATIC_LIBSTDCPP=ON
-                    -DARROW_JNI=ON
-                    -DARROW_ORC=ON
-                    -DARROW_PARQUET=ON
-                    -DARROW_PLASMA=ON
-                    -DARROW_PLASMA_JAVA_CLIENT=ON
-                    -DARROW_S3=ON
-                    -DARROW_USE_CCACHE=ON
-                    -DCMAKE_BUILD_TYPE=Release
-                    -DCMAKE_INSTALL_LIBDIR=lib
-                    -DCMAKE_INSTALL_PREFIX=java-dist
-                    -DCMAKE_UNITY_BUILD=ON
-                  </commandlineArgs>
-                  <workingDirectory>../</workingDirectory>
-                </configuration>
-              </execution>
-              <execution>
-                <id>jnidefinebuild</id>
-                <phase>generate-resources</phase>
-                <goals>
-                  <goal>exec</goal>
-                </goals>
-                <configuration>
-                  <executable>cmake</executable>
-                  <commandlineArgs>
-                    --build cpp-jni --target install --config Release
-                  </commandlineArgs>
-                  <workingDirectory>../</workingDirectory>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-
   </profiles>
 
 </project>