From 4161898d5cd7d05ad0fd9f23e1e9df9439460c98 Mon Sep 17 00:00:00 2001 From: Laurent Goujon Date: Wed, 17 Jul 2024 22:27:52 +0200 Subject: [PATCH] GH-38051: [Java] Remove Java 8 support (#43139) ### What changes are included in this PR? * Remove support for Java 8 in Github actions and other CI/CD tasks and make Java 11 now the default version * Make Java 11 the minimum version required to build and run Arrow by changing the Maven project configuration: - Change minimum java version and source/target/release compiler properties to 11 - Remove `maven` modules - Remove jdk11+ profiles and integrate their content into the main section - Let maven-compiler-plugin process `module-info.java` files and address several declaration issues - Exclude non modularized modules from javadoc aggregate tasks - Exclude module-info.class files from shaded jars as it is not representative of the whole content and may actually directly coming from a 3rd party dependency. * Update documentation ### Are these changes tested? Through CI/CD. ### Are there any user-facing changes? Yes. Java 11 is now required to run any Arrow code **This PR includes breaking changes to public APIs.** * GitHub Issue: #38051 Authored-by: Laurent Goujon Signed-off-by: Dane Pitkin --- .env | 2 +- .github/workflows/java.yml | 2 +- ci/docker/conda-integration.dockerfile | 2 +- ci/docker/conda-python-hdfs.dockerfile | 2 +- ci/docker/conda-python-spark.dockerfile | 2 +- ci/docker/java-jni-manylinux-201x.dockerfile | 2 +- ci/docker/linux-apt-docs.dockerfile | 2 +- dev/conbench_envs/README.md | 6 +- dev/release/setup-rhel-rebuilds.sh | 4 +- dev/release/verify-release-candidate.sh | 2 +- dev/tasks/tasks.yml | 13 +- docker-compose.yml | 4 +- docs/source/developers/java/building.rst | 2 +- docs/source/java/flight_sql_jdbc_driver.rst | 2 +- docs/source/java/install.rst | 4 +- java/README.md | 2 +- java/adapter/jdbc/pom.xml | 45 +- .../jdbc/src/main/java/module-info.java | 1 + java/bom/pom.xml | 6 +- java/dataset/pom.xml | 22 +- java/flight/flight-core/pom.xml | 25 +- .../src/main/java/module-info.java | 3 + java/flight/flight-integration-tests/pom.xml | 24 +- java/flight/flight-sql-jdbc-driver/pom.xml | 1 + java/flight/flight-sql/pom.xml | 20 - .../flight-sql/src/main/java/module-info.java | 1 + java/flight/pom.xml | 13 - .../module-info-compiler-maven-plugin/pom.xml | 124 ------ .../plugins/BaseModuleInfoCompilerPlugin.java | 88 ---- .../plugins/ModuleInfoCompilerPlugin.java | 56 --- .../plugins/ModuleInfoTestCompilerPlugin.java | 49 -- java/maven/pom.xml | 419 ------------------ java/memory/memory-core/pom.xml | 81 ++-- .../src/main/java/module-info.java | 3 + java/pom.xml | 109 +---- java/tools/pom.xml | 24 +- java/tools/src/main/java/module-info.java | 2 +- 37 files changed, 136 insertions(+), 1033 deletions(-) delete mode 100644 java/maven/module-info-compiler-maven-plugin/pom.xml delete mode 100644 java/maven/module-info-compiler-maven-plugin/src/main/java/org/apache/arrow/maven/plugins/BaseModuleInfoCompilerPlugin.java delete mode 100644 java/maven/module-info-compiler-maven-plugin/src/main/java/org/apache/arrow/maven/plugins/ModuleInfoCompilerPlugin.java delete mode 100644 java/maven/module-info-compiler-maven-plugin/src/main/java/org/apache/arrow/maven/plugins/ModuleInfoTestCompilerPlugin.java delete mode 100644 java/maven/pom.xml diff --git a/.env b/.env index be35921f94c3a..1358aafe824a6 100644 --- a/.env +++ b/.env @@ -61,7 +61,7 @@ GCC_VERSION="" GO=1.21.8 STATICCHECK=v0.4.7 HDFS=3.2.1 -JDK=8 +JDK=11 KARTOTHEK=latest # LLVM 12 and GCC 11 reports -Wmismatched-new-delete. LLVM=14 diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 8eb2682dc077d..d4211c2c81cb5 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -58,7 +58,7 @@ jobs: strategy: fail-fast: false matrix: - jdk: [8, 11, 17, 21, 22] + jdk: [11, 17, 21, 22] maven: [3.9.6] image: [java] env: diff --git a/ci/docker/conda-integration.dockerfile b/ci/docker/conda-integration.dockerfile index 78d2503b23df7..c602490d6b729 100644 --- a/ci/docker/conda-integration.dockerfile +++ b/ci/docker/conda-integration.dockerfile @@ -23,7 +23,7 @@ ARG arch=amd64 ARG maven=3.8.7 ARG node=16 ARG yarn=1.22 -ARG jdk=8 +ARG jdk=11 ARG go=1.21.8 # Install Archery and integration dependencies diff --git a/ci/docker/conda-python-hdfs.dockerfile b/ci/docker/conda-python-hdfs.dockerfile index fa4fa0d1fb772..4e5e1a402e282 100644 --- a/ci/docker/conda-python-hdfs.dockerfile +++ b/ci/docker/conda-python-hdfs.dockerfile @@ -20,7 +20,7 @@ ARG arch=amd64 ARG python=3.8 FROM ${repo}:${arch}-conda-python-${python} -ARG jdk=8 +ARG jdk=11 ARG maven=3.8.7 RUN mamba install -q -y \ maven=${maven} \ diff --git a/ci/docker/conda-python-spark.dockerfile b/ci/docker/conda-python-spark.dockerfile index 866f6f37f8bd9..d95fe58b529f6 100644 --- a/ci/docker/conda-python-spark.dockerfile +++ b/ci/docker/conda-python-spark.dockerfile @@ -20,7 +20,7 @@ ARG arch=amd64 ARG python=3.8 FROM ${repo}:${arch}-conda-python-${python} -ARG jdk=8 +ARG jdk=11 ARG maven=3.8.7 ARG numpy=latest diff --git a/ci/docker/java-jni-manylinux-201x.dockerfile b/ci/docker/java-jni-manylinux-201x.dockerfile index 8b73c73c1d240..479f4aa598b18 100644 --- a/ci/docker/java-jni-manylinux-201x.dockerfile +++ b/ci/docker/java-jni-manylinux-201x.dockerfile @@ -33,7 +33,7 @@ RUN vcpkg install \ --x-feature=s3 # Install Java -ARG java=1.8.0 +ARG java=11 ARG maven=3.9.3 RUN yum install -y java-$java-openjdk-devel && \ yum clean all && \ diff --git a/ci/docker/linux-apt-docs.dockerfile b/ci/docker/linux-apt-docs.dockerfile index 1c916840e071b..0804f3543c283 100644 --- a/ci/docker/linux-apt-docs.dockerfile +++ b/ci/docker/linux-apt-docs.dockerfile @@ -19,7 +19,7 @@ ARG base FROM ${base} ARG r=4.4 -ARG jdk=8 +ARG jdk=11 ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium diff --git a/dev/conbench_envs/README.md b/dev/conbench_envs/README.md index 509dc5c0c9537..7fab503974805 100644 --- a/dev/conbench_envs/README.md +++ b/dev/conbench_envs/README.md @@ -99,16 +99,16 @@ Here are steps how `@ursabot` benchmark builds use `benchmarks.env` and `hooks.s ### 2. Install Arrow dependencies for Java sudo su - apt-get install openjdk-8-jdk + apt-get install openjdk-11-jdk apt-get install maven Verify that you have at least these versions of `java`, `javac` and `maven`: # java -version - openjdk version "1.8.0_292" + openjdk version "11.0.22" 2024-01-16 .. # javac -version - javac 1.8.0_292 + javac 11.0.22 ... # mvn -version Apache Maven 3.6.3 diff --git a/dev/release/setup-rhel-rebuilds.sh b/dev/release/setup-rhel-rebuilds.sh index dc190d2d2426e..e8861a19f35b7 100755 --- a/dev/release/setup-rhel-rebuilds.sh +++ b/dev/release/setup-rhel-rebuilds.sh @@ -35,7 +35,7 @@ dnf -y install \ cmake \ git \ gobject-introspection-devel \ - java-1.8.0-openjdk-devel \ + java-11-openjdk-devel \ libcurl-devel \ llvm-devel \ llvm-toolset \ @@ -55,3 +55,5 @@ npm install -g yarn python3 -m ensurepip --upgrade alternatives --set python /usr/bin/python3 +alternatives --set java java-11-openjdk.$(uname -i) +alternatives --set javac java-11-openjdk.$(uname -i) diff --git a/dev/release/verify-release-candidate.sh b/dev/release/verify-release-candidate.sh index 2f4b203f217af..6a36109dc2fc1 100755 --- a/dev/release/verify-release-candidate.sh +++ b/dev/release/verify-release-candidate.sh @@ -21,7 +21,7 @@ # Requirements # - Ruby >= 2.3 # - Maven >= 3.8.7 -# - JDK >=8 +# - JDK >= 11 # - gcc >= 4.8 # - Node.js >= 18 # - Go >= 1.21 diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.yml index 2eb361047fc62..32534e80528af 100644 --- a/dev/tasks/tasks.yml +++ b/dev/tasks/tasks.yml @@ -745,9 +745,6 @@ tasks: - arrow-jdbc-{no_rc_snapshot_version}-tests.jar - arrow-jdbc-{no_rc_snapshot_version}.jar - arrow-jdbc-{no_rc_snapshot_version}.pom - - arrow-maven-plugins-{no_rc_snapshot_version}-cyclonedx.json - - arrow-maven-plugins-{no_rc_snapshot_version}-cyclonedx.xml - - arrow-maven-plugins-{no_rc_snapshot_version}.pom - arrow-memory-core-{no_rc_snapshot_version}-cyclonedx.json - arrow-memory-core-{no_rc_snapshot_version}-cyclonedx.xml - arrow-memory-core-{no_rc_snapshot_version}-javadoc.jar @@ -843,12 +840,6 @@ tasks: - flight-sql-jdbc-driver-{no_rc_snapshot_version}-tests.jar - flight-sql-jdbc-driver-{no_rc_snapshot_version}.jar - flight-sql-jdbc-driver-{no_rc_snapshot_version}.pom - - module-info-compiler-maven-plugin-{no_rc_snapshot_version}-cyclonedx.json - - module-info-compiler-maven-plugin-{no_rc_snapshot_version}-cyclonedx.xml - - module-info-compiler-maven-plugin-{no_rc_snapshot_version}-javadoc.jar - - module-info-compiler-maven-plugin-{no_rc_snapshot_version}-sources.jar - - module-info-compiler-maven-plugin-{no_rc_snapshot_version}.jar - - module-info-compiler-maven-plugin-{no_rc_snapshot_version}.pom ############################## NuGet packages ############################### @@ -1549,9 +1540,7 @@ tasks: image: conda-python-hdfs {% endfor %} -{% for python_version, spark_version, test_pyarrow_only, numpy_version, jdk_version in [("3.8", "v3.5.0", "false", "latest", "8"), - ("3.10", "v3.5.0", "false", "1.23", "8"), - ("3.11", "master", "false", "latest", "17")] %} +{% for python_version, spark_version, test_pyarrow_only, numpy_version, jdk_version in [("3.11", "master", "false", "latest", "17")] %} test-conda-python-{{ python_version }}-spark-{{ spark_version }}: ci: github template: docker-tests/github.linux.yml diff --git a/docker-compose.yml b/docker-compose.yml index fa248d59037d3..cf22324f7cfb4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1202,7 +1202,7 @@ services: build: args: base: ${REPO}:${ARCH}-python-${PYTHON}-wheel-manylinux-2014-vcpkg-${VCPKG} - java: 1.8.0 + java: 11 context: . dockerfile: ci/docker/java-jni-manylinux-201x.dockerfile cache_from: @@ -1747,7 +1747,7 @@ services: # docker-compose run java # Parameters: # MAVEN: 3.9.5 - # JDK: 8, 11, 17, 21 + # JDK: 11, 17, 21 image: ${ARCH}/maven:${MAVEN}-eclipse-temurin-${JDK} shm_size: *shm-size volumes: &java-volumes diff --git a/docs/source/developers/java/building.rst b/docs/source/developers/java/building.rst index 82053e901186c..5ee80211584a0 100644 --- a/docs/source/developers/java/building.rst +++ b/docs/source/developers/java/building.rst @@ -32,7 +32,7 @@ Arrow Java uses the `Maven `_ build system. Building requires: -* JDK 8+ +* JDK 11+ * Maven 3+ .. note:: diff --git a/docs/source/java/flight_sql_jdbc_driver.rst b/docs/source/java/flight_sql_jdbc_driver.rst index f95c2ac755d97..0224cc3235652 100644 --- a/docs/source/java/flight_sql_jdbc_driver.rst +++ b/docs/source/java/flight_sql_jdbc_driver.rst @@ -28,7 +28,7 @@ This driver can be used with any database that implements Flight SQL. Installation and Requirements ============================= -The driver is compatible with JDK 8+. On JDK 9+, the following JVM +The driver is compatible with JDK 11+. Note that the following JVM parameter is required: .. code-block:: shell diff --git a/docs/source/java/install.rst b/docs/source/java/install.rst index dc6a55c87fcd6..3bdd416b8e792 100644 --- a/docs/source/java/install.rst +++ b/docs/source/java/install.rst @@ -30,9 +30,9 @@ Java Compatibility ================== Java modules are compatible with JDK 8 and above. Currently, JDK versions -8, 11, 17, and 21 are tested in CI. The latest JDK is also tested in CI. +11, 17, and 21 are tested in CI. The latest JDK is also tested in CI. -When using Java 9 or later, some JDK internals must be exposed by +Note that some JDK internals must be exposed by adding ``--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED`` to the ``java`` command: .. code-block:: shell diff --git a/java/README.md b/java/README.md index 25e35c10973e9..9f1b1c63c8f41 100644 --- a/java/README.md +++ b/java/README.md @@ -85,7 +85,7 @@ variable are set, the system property takes precedence. ## Java Properties - * For Java 9 or later, should set `-Dio.netty.tryReflectionSetAccessible=true`. + * `-Dio.netty.tryReflectionSetAccessible=true` should be set. This fixes `java.lang.UnsupportedOperationException: sun.misc.Unsafe or java.nio.DirectByteBuffer.(long, int) not available`. thrown by Netty. * To support duplicate fields in a `StructVector` enable `-Darrow.struct.conflict.policy=CONFLICT_APPEND`. Duplicate fields are ignored (`CONFLICT_REPLACE`) by default and overwritten. To support different policies for diff --git a/java/adapter/jdbc/pom.xml b/java/adapter/jdbc/pom.xml index 875334af4526d..e86dfcb0b0a52 100644 --- a/java/adapter/jdbc/pom.xml +++ b/java/adapter/jdbc/pom.xml @@ -82,7 +82,6 @@ under the License. com.fasterxml.jackson.core jackson-annotations - test @@ -93,24 +92,30 @@ under the License. - - - jdk11+ - - [11,] - - - - - org.apache.maven.plugins - maven-surefire-plugin - - --add-reads=org.apache.arrow.adapter.jdbc=com.fasterxml.jackson.dataformat.yaml --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED -Duser.timezone=UTC + + + + org.apache.maven.plugins + maven-dependency-plugin + + + analyze + verify + + + com.fasterxml.jackson.core:jackson-annotations + - - - - - - + + + + + org.apache.maven.plugins + maven-surefire-plugin + + --add-reads=org.apache.arrow.adapter.jdbc=com.fasterxml.jackson.dataformat.yaml --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED -Duser.timezone=UTC + + + + diff --git a/java/adapter/jdbc/src/main/java/module-info.java b/java/adapter/jdbc/src/main/java/module-info.java index 5b59ce768472a..04977222c1530 100644 --- a/java/adapter/jdbc/src/main/java/module-info.java +++ b/java/adapter/jdbc/src/main/java/module-info.java @@ -20,6 +20,7 @@ exports org.apache.arrow.adapter.jdbc; exports org.apache.arrow.adapter.jdbc.binder; + requires com.fasterxml.jackson.annotation; requires com.fasterxml.jackson.databind; requires java.sql; requires jdk.unsupported; diff --git a/java/bom/pom.xml b/java/bom/pom.xml index e51906cd77e35..ad6532b1192bb 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -79,8 +79,10 @@ under the License. - 1.8 - 1.8 + 11 + 11 + 11 + 11 3.12.0 3.2.5 0.16.1 diff --git a/java/dataset/pom.xml b/java/dataset/pom.xml index c5c7468ccee84..74071a6c305ad 100644 --- a/java/dataset/pom.xml +++ b/java/dataset/pom.xml @@ -165,6 +165,7 @@ under the License. test + @@ -179,6 +180,7 @@ under the License. maven-surefire-plugin + --add-reads=org.apache.arrow.dataset=com.fasterxml.jackson.databind --add-opens=java.base/java.nio=org.apache.arrow.dataset,org.apache.arrow.memory.core,ALL-UNNAMED false ${project.basedir}/../../testing/data @@ -202,24 +204,4 @@ under the License. - - - - jdk11+ - - [11,] - - - - - org.apache.maven.plugins - maven-surefire-plugin - - --add-reads=org.apache.arrow.dataset=com.fasterxml.jackson.databind --add-opens=java.base/java.nio=org.apache.arrow.dataset,org.apache.arrow.memory.core,ALL-UNNAMED - - - - - - diff --git a/java/flight/flight-core/pom.xml b/java/flight/flight-core/pom.xml index c00bba5e6c763..d4083383a2f44 100644 --- a/java/flight/flight-core/pom.xml +++ b/java/flight/flight-core/pom.xml @@ -144,11 +144,13 @@ under the License. test + maven-surefire-plugin + --add-opens=org.apache.arrow.flight.core/org.apache.arrow.flight.perf.impl=protobuf.java --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED false ${project.basedir}/../../../testing/data @@ -198,27 +200,4 @@ under the License. - - - - jdk11+ - - [11,] - - - - - org.apache.maven.plugins - maven-surefire-plugin - - --add-opens=org.apache.arrow.flight.core/org.apache.arrow.flight.perf.impl=protobuf.java --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED - - ${project.basedir}/../../../testing/data - - - - - - - diff --git a/java/flight/flight-core/src/main/java/module-info.java b/java/flight/flight-core/src/main/java/module-info.java index f6bf5b73b0972..ff0d7427b59cc 100644 --- a/java/flight/flight-core/src/main/java/module-info.java +++ b/java/flight/flight-core/src/main/java/module-info.java @@ -31,12 +31,15 @@ requires io.grpc.netty; requires io.grpc.protobuf; requires io.grpc.stub; + requires io.netty.buffer; requires io.netty.common; requires io.netty.handler; requires io.netty.transport; + requires jsr305; requires org.apache.arrow.format; requires org.apache.arrow.memory.core; requires org.apache.arrow.vector; requires protobuf.java; + requires protobuf.java.util; requires org.slf4j; } diff --git a/java/flight/flight-integration-tests/pom.xml b/java/flight/flight-integration-tests/pom.xml index 97bce0c6ed5e3..a154062ba814d 100644 --- a/java/flight/flight-integration-tests/pom.xml +++ b/java/flight/flight-integration-tests/pom.xml @@ -69,19 +69,29 @@ under the License. - maven-assembly-plugin - - - jar-with-dependencies - - + maven-shade-plugin make-assembly - single + shade package + + false + true + jar-with-dependencies + + + + **/module-info.class + + + + + + + diff --git a/java/flight/flight-sql-jdbc-driver/pom.xml b/java/flight/flight-sql-jdbc-driver/pom.xml index 524b9cd4f8aae..3dfe3bcd33f50 100644 --- a/java/flight/flight-sql-jdbc-driver/pom.xml +++ b/java/flight/flight-sql-jdbc-driver/pom.xml @@ -161,6 +161,7 @@ under the License. META-INF/native/libio_grpc_netty* META-INF/native/io_grpc_netty_shaded* **/*.proto + **/module-info.class diff --git a/java/flight/flight-sql/pom.xml b/java/flight/flight-sql/pom.xml index 9c8c5df07fb78..fc6c789ee99d6 100644 --- a/java/flight/flight-sql/pom.xml +++ b/java/flight/flight-sql/pom.xml @@ -120,24 +120,4 @@ under the License. true - - - - jdk11+ - - [11,] - - - - - org.apache.maven.plugins - maven-surefire-plugin - - --add-reads=org.apache.arrow.flight.sql=org.slf4j --add-reads=org.apache.arrow.flight.core=ALL-UNNAMED --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED - - - - - - diff --git a/java/flight/flight-sql/src/main/java/module-info.java b/java/flight/flight-sql/src/main/java/module-info.java index 5514d5b870afd..cb3835117daf6 100644 --- a/java/flight/flight-sql/src/main/java/module-info.java +++ b/java/flight/flight-sql/src/main/java/module-info.java @@ -25,5 +25,6 @@ requires org.apache.arrow.flight.core; requires org.apache.arrow.memory.core; requires org.apache.arrow.vector; + requires org.apache.commons.cli; requires protobuf.java; } diff --git a/java/flight/pom.xml b/java/flight/pom.xml index 851f44d7bf19e..55511eba82b3a 100644 --- a/java/flight/pom.xml +++ b/java/flight/pom.xml @@ -37,17 +37,4 @@ under the License. flight-sql-jdbc-driver flight-integration-tests - - - - pin-mockito-jdk8 - - 1.8 - - - 4.11.0 - 5.2.0 - - - diff --git a/java/maven/module-info-compiler-maven-plugin/pom.xml b/java/maven/module-info-compiler-maven-plugin/pom.xml deleted file mode 100644 index 77184d35b5ac7..0000000000000 --- a/java/maven/module-info-compiler-maven-plugin/pom.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - 4.0.0 - - org.apache.arrow.maven.plugins - arrow-maven-plugins - 18.0.0-SNAPSHOT - - module-info-compiler-maven-plugin - maven-plugin - - Module Info Compiler Maven Plugin - - https://arrow.apache.org - - - ${maven.version} - - - - 3.8.7 - - - - - org.glavo - module-info-compiler - 2.0 - - - org.apache.maven - maven-plugin-api - ${maven.version} - provided - - - org.apache.maven - maven-core - ${maven.version} - provided - - - org.apache.maven - maven-artifact - ${maven.version} - provided - - - org.apache.maven - maven-model - ${maven.version} - provided - - - org.apache.maven.plugin-tools - maven-plugin-annotations - ${maven.plugin.tools.version} - provided - - - - - - - - com.gradle - develocity-maven-extension - - - - - - arrow-git.properties - - - - - - - - - - - org.apache.maven.plugins - maven-plugin-plugin - - true - - - - mojo-descriptor - - descriptor - - - - help-goal - - helpmojo - - - - - - - diff --git a/java/maven/module-info-compiler-maven-plugin/src/main/java/org/apache/arrow/maven/plugins/BaseModuleInfoCompilerPlugin.java b/java/maven/module-info-compiler-maven-plugin/src/main/java/org/apache/arrow/maven/plugins/BaseModuleInfoCompilerPlugin.java deleted file mode 100644 index 4fc8fc46e6bcc..0000000000000 --- a/java/maven/module-info-compiler-maven-plugin/src/main/java/org/apache/arrow/maven/plugins/BaseModuleInfoCompilerPlugin.java +++ /dev/null @@ -1,88 +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. - */ -package org.apache.arrow.maven.plugins; - -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.Reader; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.Optional; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.glavo.mic.ModuleInfoCompiler; - -/** Compiles the first module-info.java file in the project purely syntactically. */ -public abstract class BaseModuleInfoCompilerPlugin extends AbstractMojo { - protected abstract List getSourceRoots(); - - protected abstract boolean skip(); - - protected abstract String getOutputDirectory(); - - @Override - public void execute() throws MojoExecutionException { - if (skip()) { - getLog().info("Skipping module-info-compiler-maven-plugin"); - return; - } - - Optional moduleInfoFile = findFirstModuleInfo(getSourceRoots()); - if (moduleInfoFile.isPresent()) { - // The compiled module-info.class file goes into target/classes/module-info/main - Path outputDir = Paths.get(getOutputDirectory()); - - outputDir.toFile().mkdirs(); - Path targetPath = outputDir.resolve("module-info.class"); - - // Invoke the compiler, - ModuleInfoCompiler compiler = new ModuleInfoCompiler(); - try (Reader reader = - new InputStreamReader( - Files.newInputStream(moduleInfoFile.get().toPath()), StandardCharsets.UTF_8); - OutputStream output = Files.newOutputStream(targetPath)) { - compiler.compile(reader, output); - getLog().info("Successfully wrote module-info.class file."); - } catch (IOException ex) { - throw new MojoExecutionException("Error compiling module-info.java", ex); - } - } else { - getLog().info("No module-info.java file found. module-info.class file was not generated."); - } - } - - /** Finds the first module-info.java file in the set of source directories. */ - private Optional findFirstModuleInfo(List sourceDirectories) { - if (sourceDirectories == null) { - return Optional.empty(); - } - - return sourceDirectories.stream() - .map(Paths::get) - .map( - sourcePath -> - sourcePath.toFile().listFiles(file -> file.getName().equals("module-info.java"))) - .filter(matchingFiles -> matchingFiles != null && matchingFiles.length != 0) - .map(matchingFiles -> matchingFiles[0]) - .findAny(); - } -} diff --git a/java/maven/module-info-compiler-maven-plugin/src/main/java/org/apache/arrow/maven/plugins/ModuleInfoCompilerPlugin.java b/java/maven/module-info-compiler-maven-plugin/src/main/java/org/apache/arrow/maven/plugins/ModuleInfoCompilerPlugin.java deleted file mode 100644 index e66a475dbf8be..0000000000000 --- a/java/maven/module-info-compiler-maven-plugin/src/main/java/org/apache/arrow/maven/plugins/ModuleInfoCompilerPlugin.java +++ /dev/null @@ -1,56 +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. - */ -package org.apache.arrow.maven.plugins; - -import java.util.ArrayList; -import java.util.List; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; - -/** A maven plugin for compiler module-info files in main code with JDK8. */ -@Mojo(name = "compile", defaultPhase = LifecyclePhase.COMPILE) -public class ModuleInfoCompilerPlugin extends BaseModuleInfoCompilerPlugin { - - @Parameter( - defaultValue = "${project.compileSourceRoots}", - property = "compileSourceRoots", - required = true) - private final List compileSourceRoots = new ArrayList<>(); - - @Parameter(defaultValue = "false", property = "skip", required = false) - private boolean skip = false; - - @Parameter(defaultValue = "${project}", readonly = true, required = true) - private MavenProject project; - - @Override - protected List getSourceRoots() { - return compileSourceRoots; - } - - @Override - protected boolean skip() { - return skip; - } - - @Override - protected String getOutputDirectory() { - return project.getBuild().getOutputDirectory(); - } -} diff --git a/java/maven/module-info-compiler-maven-plugin/src/main/java/org/apache/arrow/maven/plugins/ModuleInfoTestCompilerPlugin.java b/java/maven/module-info-compiler-maven-plugin/src/main/java/org/apache/arrow/maven/plugins/ModuleInfoTestCompilerPlugin.java deleted file mode 100644 index f18ac9faac735..0000000000000 --- a/java/maven/module-info-compiler-maven-plugin/src/main/java/org/apache/arrow/maven/plugins/ModuleInfoTestCompilerPlugin.java +++ /dev/null @@ -1,49 +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. - */ -package org.apache.arrow.maven.plugins; - -import java.util.List; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; - -/** A maven plugin for compiler module-info files in unit tests with JDK8. */ -@Mojo(name = "testCompile", defaultPhase = LifecyclePhase.TEST_COMPILE) -public class ModuleInfoTestCompilerPlugin extends BaseModuleInfoCompilerPlugin { - - @Parameter(defaultValue = "false", property = "skip", required = false) - private boolean skip = false; - - @Parameter(defaultValue = "${project}", readonly = true, required = true) - private MavenProject project; - - @Override - protected List getSourceRoots() { - return project.getTestCompileSourceRoots(); - } - - @Override - protected boolean skip() { - return skip; - } - - @Override - protected String getOutputDirectory() { - return project.getBuild().getTestOutputDirectory(); - } -} diff --git a/java/maven/pom.xml b/java/maven/pom.xml deleted file mode 100644 index d342b629358dd..0000000000000 --- a/java/maven/pom.xml +++ /dev/null @@ -1,419 +0,0 @@ - - - - 4.0.0 - - - org.apache - apache - 31 - - - - org.apache.arrow.maven.plugins - arrow-maven-plugins - 18.0.0-SNAPSHOT - pom - - Arrow Maven Plugins - https://arrow.apache.org/ - - - - Developer List - dev-subscribe@arrow.apache.org - dev-unsubscribe@arrow.apache.org - dev@arrow.apache.org - https://lists.apache.org/list.html?dev@arrow.apache.org - - - Commits List - commits-subscribe@arrow.apache.org - commits-unsubscribe@arrow.apache.org - commits@arrow.apache.org - https://lists.apache.org/list.html?commits@arrow.apache.org - - - Issues List - issues-subscribe@arrow.apache.org - issues-unsubscribe@arrow.apache.org - https://lists.apache.org/list.html?issues@arrow.apache.org - - - GitHub List - github-subscribe@arrow.apache.org - github-unsubscribe@arrow.apache.org - https://lists.apache.org/list.html?github@arrow.apache.org - - - - - module-info-compiler-maven-plugin - - - - scm:git:https://github.com/apache/arrow.git - scm:git:https://github.com/apache/arrow.git - main - https://github.com/apache/arrow/tree/${project.scm.tag} - - - - GitHub - https://github.com/apache/arrow/issues - - - - true - - 1.8 - 1.8 - 3.13.1 - 3.2.5 - 0.16.1 - 3.7.1 - 3.12.1 - 3.6.1 - 3.2.4 - 3.2.2 - 3.6.3 - 3.5.0 - - - - - - - com.diffplug.spotless - spotless-maven-plugin - 2.30.0 - - - pl.project13.maven - git-commit-id-plugin - 4.9.10 - - - org.cyclonedx - cyclonedx-maven-plugin - 2.8.0 - - - org.codehaus.mojo - versions-maven-plugin - 2.17.0 - - - - - - org.apache.rat - apache-rat-plugin - - false - - **/dependency-reduced-pom.xml - **/*.log - **/*.css - **/*.js - **/*.md - **/*.eps - **/*.json - **/*.seq - **/*.parquet - **/*.sql - **/arrow-git.properties - **/*.csv - **/*.csvh - **/*.csvh-test - **/*.tsv - **/*.txt - **/*.ssv - **/arrow-*.conf - **/.buildpath - **/*.proto - **/*.fmpp - **/target/** - **/*.tdd - **/*.project - **/TAGS - **/*.checkstyle - **/.classpath - **/.factorypath - **/.settings/** - .*/** - **/*.patch - **/*.pb.cc - **/*.pb.h - **/*.linux - **/client/build/** - **/*.tbl - **/*.iml - **/flight.properties - **/*.idea/** - - - - - rat-checks - - check - - validate - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - **/logging.properties - **/logback-test.xml - **/logback.out.xml - **/logback.xml - - - - org.apache.arrow - ${username} - https://arrow.apache.org/ - - - - - - - test-jar - - - true - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 2048m - true - - - - maven-enforcer-plugin - - - avoid_bad_dependencies - - enforce - - verify - - - - - commons-logging - javax.servlet:servlet-api - org.mortbay.jetty:servlet-api - org.mortbay.jetty:servlet-api-2.5 - log4j:log4j - - - - - - - - - pl.project13.maven - git-commit-id-plugin - - dd.MM.yyyy '@' HH:mm:ss z - false - false - true - false - - false - false - 7 - -dirty - true - - - - - for-jars - - revision - - true - - target/classes/arrow-git.properties - - - - for-source-tarball - - revision - - false - - ./arrow-git.properties - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - ../dev/checkstyle/checkstyle.xml - ../dev/license/asf-java.license - ../dev/checkstyle/suppressions.xml - true - UTF-8 - true - ${checkstyle.failOnViolation} - ${checkstyle.failOnViolation} - warning - xml - ${project.build.directory}/test/checkstyle-errors.xml - false - - - - com.puppycrawl.tools - checkstyle - 8.29 - - - org.slf4j - jcl-over-slf4j - 2.0.13 - - - - - validate - - check - - validate - - - - - org.cyclonedx - cyclonedx-maven-plugin - - - - makeBom - - package - - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - - org.apache.maven.plugins - maven-site-plugin - - - com.diffplug.spotless - spotless-maven-plugin - - - - ${maven.multiModuleProjectDirectory}/dev/license/asf-xml.license - (<configuration|<project) - - - - - - 1.7 - - - - ${maven.multiModuleProjectDirectory}/dev/license/asf-java.license - package - - - - - - spotless-check - - check - - - - - - - - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - - org.apache.maven.plugins - maven-site-plugin - - - - - - - apache-release - - - - org.apache.maven.plugins - maven-assembly-plugin - - - source-release-assembly - - - true - - - - - - - - - diff --git a/java/memory/memory-core/pom.xml b/java/memory/memory-core/pom.xml index 95ef16aaa1cfe..ce78fc479232a 100644 --- a/java/memory/memory-core/pom.xml +++ b/java/memory/memory-core/pom.xml @@ -51,10 +51,35 @@ under the License. + + org.apache.maven.plugins + maven-compiler-plugin + + + -Xmaxerrs + + 10000 + -Xmaxwarns + 10000 + -AskipDefs=.*Test + + -AatfDoNotCache + + + + + org.checkerframework + checker + ${checker.framework.version} + + + + org.apache.maven.plugins maven-surefire-plugin + --add-reads=org.apache.arrow.memory.core=ch.qos.logback.classic --add-opens=java.base/java.lang.reflect=org.apache.arrow.memory.core --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED **/TestOpens.java @@ -65,27 +90,6 @@ under the License. - - jdk11+ - - [11,] - - - - - org.apache.maven.plugins - maven-surefire-plugin - - --add-reads=org.apache.arrow.memory.core=ch.qos.logback.classic --add-opens=java.base/java.lang.reflect=org.apache.arrow.memory.core --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED - - - **/TestOpens.java - - - - - - opens-tests @@ -118,40 +122,5 @@ under the License. - - - checkerframework-jdk11+ - - [11,] - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - -Xmaxerrs - - 10000 - -Xmaxwarns - 10000 - -AskipDefs=.*Test - - -AatfDoNotCache - - - - - org.checkerframework - checker - ${checker.framework.version} - - - - - - - diff --git a/java/memory/memory-core/src/main/java/module-info.java b/java/memory/memory-core/src/main/java/module-info.java index 52fcb52d014a5..e2a07626c386f 100644 --- a/java/memory/memory-core/src/main/java/module-info.java +++ b/java/memory/memory-core/src/main/java/module-info.java @@ -22,7 +22,10 @@ exports org.apache.arrow.memory.util.hash; exports org.apache.arrow.util; + requires java.compiler; requires transitive jdk.unsupported; requires jsr305; + requires static org.checkerframework.checker.qual; + requires static org.immutables.value.annotations; requires org.slf4j; } diff --git a/java/pom.xml b/java/pom.xml index 4ce0c1981d295..4228496ef682f 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -65,7 +65,6 @@ under the License. - maven bom format memory @@ -98,7 +97,7 @@ under the License. 2.0.13 33.2.1-jre 4.1.110.Final - 1.63.0 + 1.65.0 3.25.1 2.17.2 3.4.0 @@ -115,8 +114,10 @@ under the License. none -Xdoclint:none - 1.8 - 1.8 + 11 + 11 + 11 + 11 3.12.0 3.2.5 0.16.1 @@ -298,8 +299,6 @@ under the License. maven-compiler-plugin true - **/module-info.java - **/module-info.java false @@ -313,6 +312,7 @@ under the License. maven-surefire-plugin + --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED true true ${forkCount} @@ -325,11 +325,13 @@ under the License. which in turn can cause OOM. --> 1048576 + false maven-failsafe-plugin + --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED ${project.build.directory} true @@ -444,13 +446,9 @@ under the License. **/module-info.java + arrow-memory-netty-buffer-patch,arrow-memory-netty,flight-sql-jdbc-core,flight-integration-tests,arrow-performance - - org.apache.arrow.maven.plugins - module-info-compiler-maven-plugin - ${project.version} - com.gradle develocity-maven-extension @@ -491,6 +489,7 @@ under the License. com.google.protobuf:protoc:${dep.protobuf-bom.version}:exe:${os.detected.classifier} grpc-java io.grpc:protoc-gen-grpc-java:${dep.grpc-bom.version}:exe:${os.detected.classifier} + @generated=omit @@ -779,24 +778,6 @@ under the License. - - org.apache.arrow.maven.plugins - module-info-compiler-maven-plugin - - - default-compile - - compile - - - - default-testCompile - - testCompile - - - - org.apache.maven.plugins maven-project-info-reports-plugin @@ -856,6 +837,7 @@ under the License. **/module-info.java + arrow-memory-netty-buffer-patch,arrow-memory-netty,flight-sql-jdbc-core,flight-integration-tests,arrow-performance @@ -917,56 +899,13 @@ under the License. - error-prone-jdk8 + error-prone - 1.8 - - !m2e.version - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - -XDcompilePolicy=simple - -Xplugin:ErrorProne - -J-Xbootclasspath/p:${settings.localRepository}/com/google/errorprone/javac/${errorprone.javac.version}/javac-${errorprone.javac.version}.jar - - - - com.google.errorprone - error_prone_core - - 2.10.0 - - - - - - - - - - error-prone-jdk11+ - - [11,] !m2e.version @@ -1003,30 +942,6 @@ under the License. - - jdk11+ - - [11,] - - - - - org.apache.maven.plugins - maven-surefire-plugin - - --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED - - - - org.apache.maven.plugins - maven-failsafe-plugin - - --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED - - - - - code-coverage diff --git a/java/tools/pom.xml b/java/tools/pom.xml index b69d24786cb14..9c52e21402bcd 100644 --- a/java/tools/pom.xml +++ b/java/tools/pom.xml @@ -97,19 +97,29 @@ under the License. - maven-assembly-plugin - - - jar-with-dependencies - - + maven-shade-plugin make-assembly - single + shade package + + false + true + jar-with-dependencies + + + + **/module-info.class + + + + + + + diff --git a/java/tools/src/main/java/module-info.java b/java/tools/src/main/java/module-info.java index 6b4329eb84f2a..4f0817f9a11f6 100644 --- a/java/tools/src/main/java/module-info.java +++ b/java/tools/src/main/java/module-info.java @@ -19,9 +19,9 @@ exports org.apache.arrow.tools; requires com.fasterxml.jackson.databind; - requires com.google.common; requires org.apache.arrow.compression; requires org.apache.arrow.memory.core; requires org.apache.arrow.vector; + requires org.apache.commons.cli; requires org.slf4j; }