Skip to content

Commit 83e0c8d

Browse files
committed
JAVA-3078: Provide support for building with Java 11 and Java 17
Details: - Update to api-plumber-doclet 2.0.0 - Add org.jetbrains:annotations as additionalDependency for core-shaded - Refactor table summary tag as caption element to conform to HTML5 - Refactor <h3> usage to <h2> to conform to heading tag ordering for HTML5 - Explicitly define annotationProcessorPaths for mapper-processor, slf4j-nop and gremlin-core - [java11+] Upgrade errorprone to 2.19.1 - [java11+] Update custom javadoc leaks tag to full string: leaks-private-api - Add build-java-8 profile for compiling with java 8 - Add build-java-11 profile for compiling with java 11 - [java11+] Exclude many new error prone checks enabled by default in the new version (see JAVA-3102) - [java11+] Use release=8 instead of source/target=1.8 to automatically select correct bootstrap path - [java11+] Use fork=true with maven-compiler-plugin to pick up compilerArgs - [java11+] Load error-prone plugin using annotationProcessorPaths, per documentation guidance - Refactor Jenkinsfile to compile project with the Java version selected in the pipeline matrix - Remove test-jdk profiles and surefire/failsafe JVM overrides added in JAVA-3042 - Update org.apache.felix.framework to 7.0.1 to support java17 without forking new JVM (FELIX-6287) - Update commons-configuration2 in OSGi BundleOptions to 2.9.0 for java11 - [java11+] Set JAVA_HOME=JAVA8_HOME in CcmBridge if using DSE which only supports java8 - set --jvm_version when calling ccm start for dse that supports java11 (workaround DSP-23501) - update travis config to run full build + test with java 11 + 17
1 parent d990f92 commit 83e0c8d

File tree

22 files changed

+274
-162
lines changed

22 files changed

+274
-162
lines changed

.travis.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ matrix:
77
# 8
88
- env: JDK='OpenJDK 8'
99
jdk: openjdk8
10+
before_install:
11+
# Require JDK8 for compiling
12+
- jdk_switcher use openjdk8
13+
- ./install-snapshots.sh
1014
# 11
1115
- env: JDK='OpenJDK 11'
12-
# switch to JDK 11 before running tests
13-
before_script: . $TRAVIS_BUILD_DIR/ci/install-jdk.sh -F 11 -L GPL
14-
before_install:
15-
# Require JDK8 for compiling
16-
- jdk_switcher use openjdk8
17-
- ./install-snapshots.sh
16+
before_install:
17+
- . $TRAVIS_BUILD_DIR/ci/install-jdk.sh -F 11 -L GPL
18+
- ./install-snapshots.sh
19+
# 17
20+
- env: JDK='OpenJDK 17'
21+
before_install:
22+
- . $TRAVIS_BUILD_DIR/ci/install-jdk.sh -F 17 -L GPL
23+
- ./install-snapshots.sh
1824
install: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
1925
script: mvn test -Djacoco.skip=true -Dmaven.test.failure.ignore=true -Dmaven.javadoc.skip=true -B -V
2026
cache:

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# https://github.com/apache/cassandra-builds/blob/trunk/docker/testing/ubuntu2004_j11_w_dependencies.docker
2+
FROM apache/cassandra-testing-ubuntu2004-java11-w-dependencies:latest as base
3+
4+
# install maven
5+
RUN sudo su -c 'apt-get update && apt-get install -y maven'
6+
7+
FROM base as repo
8+
9+
# checkout java-driver (special branch for now)
10+
RUN git clone --branch asf_cassandra_docker_image --single-branch https://github.com/datastax/java-driver.git
11+
12+
FROM repo as install
13+
14+
WORKDIR /home/cassandra/java-driver
15+
16+
# build java-driver
17+
RUN mvn -V -DskipTests install
18+
19+
FROM install as test
20+
21+
# manually set JAVA_HOME which is not configued by default in the base image
22+
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-arm64
23+
24+
# activate python3.8+ccm and run java-driver tests
25+
# use cassandra 4.0.11 to work around CASSANDRA-17581
26+
RUN . /home/cassandra/env3.8/bin/activate && mvn -V verify -Dccm.version=4.0.11

Jenkinsfile

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,13 @@ def initializeEnvironment() {
1919
env.MAVEN_HOME = "${env.HOME}/.mvn/apache-maven-3.3.9"
2020
env.PATH = "${env.MAVEN_HOME}/bin:${env.PATH}"
2121

22-
/*
23-
* As of JAVA-3042 JAVA_HOME is always set to JDK8 and this is currently necessary for mvn compile and DSE Search/Graph.
24-
* To facilitate testing with JDK11/17 we feed the appropriate JAVA_HOME into the maven build via commandline.
25-
*
26-
* Maven command-line flags:
27-
* - -DtestJavaHome=/path/to/java/home: overrides JAVA_HOME for surefire/failsafe tests, defaults to environment JAVA_HOME.
28-
* - -Ptest-jdk-N: enables profile for running tests with a specific JDK version (substitute N for 8/11/17).
29-
*
30-
* Note test-jdk-N is also automatically loaded based off JAVA_HOME SDK version so testing with an older SDK is not supported.
31-
*
32-
* Environment variables:
33-
* - JAVA_HOME: Path to JDK used for mvn (all steps except surefire/failsafe), Cassandra, DSE.
34-
* - JAVA8_HOME: Path to JDK8 used for Cassandra/DSE if ccm determines JAVA_HOME is not compatible with the chosen backend.
35-
* - TEST_JAVA_HOME: PATH to JDK used for surefire/failsafe testing.
36-
* - TEST_JAVA_VERSION: TEST_JAVA_HOME SDK version number [8/11/17], used to configure test-jdk-N profile in maven (see above)
37-
*/
38-
3922
env.JAVA_HOME = sh(label: 'Get JAVA_HOME',script: '''#!/bin/bash -le
4023
. ${JABBA_SHELL}
4124
jabba which ${JABBA_VERSION}''', returnStdout: true).trim()
4225
env.JAVA8_HOME = sh(label: 'Get JAVA8_HOME',script: '''#!/bin/bash -le
4326
. ${JABBA_SHELL}
4427
jabba which 1.8''', returnStdout: true).trim()
4528

46-
env.TEST_JAVA_HOME = sh(label: 'Get TEST_JAVA_HOME',script: '''#!/bin/bash -le
47-
. ${JABBA_SHELL}
48-
jabba which ${JABBA_VERSION}''', returnStdout: true).trim()
49-
env.TEST_JAVA_VERSION = sh(label: 'Get TEST_JAVA_VERSION',script: '''#!/bin/bash -le
50-
echo "${JABBA_VERSION##*.}"''', returnStdout: true).trim()
51-
5229
sh label: 'Download Apache CassandraⓇ or DataStax Enterprise',script: '''#!/bin/bash -le
5330
. ${JABBA_SHELL}
5431
jabba use 1.8
@@ -77,23 +54,21 @@ ENVIRONMENT_EOF
7754
set +o allexport
7855
7956
. ${JABBA_SHELL}
80-
jabba use 1.8
57+
jabba use ${JABBA_VERSION}
8158
8259
java -version
8360
mvn -v
8461
printenv | sort
8562
'''
8663
}
8764

88-
def buildDriver(jabbaVersion) {
89-
withEnv(["BUILD_JABBA_VERSION=${jabbaVersion}"]) {
90-
sh label: 'Build driver', script: '''#!/bin/bash -le
91-
. ${JABBA_SHELL}
92-
jabba use ${BUILD_JABBA_VERSION}
65+
def buildDriver() {
66+
sh label: 'Build driver', script: '''#!/bin/bash -le
67+
. ${JABBA_SHELL}
68+
jabba use ${JABBA_VERSION}
9369
94-
mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true
95-
'''
96-
}
70+
mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true
71+
'''
9772
}
9873

9974
def executeTests() {
@@ -104,13 +79,7 @@ def executeTests() {
10479
set +o allexport
10580
10681
. ${JABBA_SHELL}
107-
jabba use 1.8
108-
109-
if [ "${JABBA_VERSION}" != "1.8" ]; then
110-
SKIP_JAVADOCS=true
111-
else
112-
SKIP_JAVADOCS=false
113-
fi
82+
jabba use ${JABBA_VERSION}
11483
11584
INTEGRATION_TESTS_FILTER_ARGUMENT=""
11685
if [ ! -z "${INTEGRATION_TESTS_FILTER}" ]; then
@@ -119,11 +88,8 @@ def executeTests() {
11988
printenv | sort
12089
12190
mvn -B -V ${INTEGRATION_TESTS_FILTER_ARGUMENT} -T 1 verify \
122-
-Ptest-jdk-${TEST_JAVA_VERSION} \
123-
-DtestJavaHome=${TEST_JAVA_HOME} \
12491
-DfailIfNoTests=false \
12592
-Dmaven.test.failure.ignore=true \
126-
-Dmaven.javadoc.skip=${SKIP_JAVADOCS} \
12793
-Dccm.version=${CCM_CASSANDRA_VERSION} \
12894
-Dccm.dse=${CCM_IS_DSE} \
12995
-Dproxy.path=${HOME}/proxy \
@@ -459,7 +425,7 @@ pipeline {
459425
}
460426
stage('Build-Driver') {
461427
steps {
462-
buildDriver('default')
428+
buildDriver()
463429
}
464430
}
465431
stage('Execute-Tests') {
@@ -573,8 +539,7 @@ pipeline {
573539
}
574540
stage('Build-Driver') {
575541
steps {
576-
// Jabba default should be a JDK8 for now
577-
buildDriver('default')
542+
buildDriver()
578543
}
579544
}
580545
stage('Execute-Tests') {

ci/install-jdk.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ function determine_url() {
200200
10-BCL) url="${ORACLE}/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_${os}_bin.tar.gz"; return;;
201201
11-GPL) url="${DOWNLOAD}/GA/jdk11/13/GPL/openjdk-11.0.1_${os}_bin.tar.gz"; return;;
202202
11-BCL) url="${ORACLE}/11.0.1+13/90cf5d8f270a4347a95050320eef3fb7/jdk-11.0.1_${os}_bin.tar.gz"; return;;
203+
17-GPL) url="${DOWNLOAD}/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_${os}_bin.tar.gz"; return;;
203204
esac
204205

205206
# EA or RC build?

core-shaded/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,11 @@
283283
<artifactId>esri-geometry-api</artifactId>
284284
<version>1.2.1</version>
285285
</additionalDependency>
286+
<additionalDependency>
287+
<groupId>org.jetbrains</groupId>
288+
<artifactId>annotations</artifactId>
289+
<version>24.0.1</version>
290+
</additionalDependency>
286291
</additionalDependencies>
287292
</configuration>
288293
</execution>

core/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@
248248
<plugin>
249249
<artifactId>maven-surefire-plugin</artifactId>
250250
<configuration>
251-
<jvm>${testing.jvm}/bin/java</jvm>
252251
<argLine>${mockitoopens.argline}</argLine>
253252
<threadCount>1</threadCount>
254253
<properties>

core/src/main/java/com/datastax/oss/driver/api/core/CqlIdentifier.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
*
4242
* Examples:
4343
*
44-
* <table summary="examples">
44+
* <table>
45+
* <caption>examples</caption>
4546
* <tr><th>Create statement</th><th>Case-sensitive?</th><th>CQL id</th><th>Internal id</th></tr>
4647
* <tr><td>CREATE TABLE t(foo int PRIMARY KEY)</td><td>No</td><td>foo</td><td>foo</td></tr>
4748
* <tr><td>CREATE TABLE t(Foo int PRIMARY KEY)</td><td>No</td><td>foo</td><td>foo</td></tr>

core/src/main/java/com/datastax/oss/driver/api/core/paging/OffsetPager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* a reasonable trade-off if the cardinality stays low. This class provides a way to emulate this
4545
* behavior on the client side.
4646
*
47-
* <h3>Performance considerations</h3>
47+
* <h2>Performance considerations</h2>
4848
*
4949
* For each page that you want to retrieve:
5050
*
@@ -69,7 +69,7 @@
6969
* OffsetPager.Page&lt;Row&gt; page5 = pager.getPage(rs, 5);
7070
* </pre>
7171
*
72-
* <h3>Establishing application-level guardrails</h3>
72+
* <h2>Establishing application-level guardrails</h2>
7373
*
7474
* Linear performance should be fine for the values typically encountered in real-world
7575
* applications: for example, if the page size is 25 and users never go past page 10, the worst case
@@ -79,7 +79,7 @@
7979
* maximum, so that an attacker can't inject a large value that could potentially fetch millions of
8080
* rows.
8181
*
82-
* <h3>Relation with protocol-level paging</h3>
82+
* <h2>Relation with protocol-level paging</h2>
8383
*
8484
* Protocol-level paging refers to the ability to split large response into multiple network chunks:
8585
* see {@link Statement#setPageSize(int)} and {@code basic.request.page-size} in the configuration.

integration-tests/pom.xml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,37 @@
219219
</dependencies>
220220
<build>
221221
<plugins>
222+
<plugin>
223+
<artifactId>maven-compiler-plugin</artifactId>
224+
<executions>
225+
<execution>
226+
<id>process-test-annotations</id>
227+
<phase>generate-test-resources</phase>
228+
<goals>
229+
<goal>testCompile</goal>
230+
</goals>
231+
<configuration>
232+
<annotationProcessorPaths>
233+
<path>
234+
<groupId>com.datastax.oss</groupId>
235+
<artifactId>java-driver-mapper-processor</artifactId>
236+
<version>${project.version}</version>
237+
</path>
238+
<path>
239+
<groupId>org.slf4j</groupId>
240+
<artifactId>slf4j-nop</artifactId>
241+
<version>${slf4j.version}</version>
242+
</path>
243+
<path>
244+
<groupId>org.apache.tinkerpop</groupId>
245+
<artifactId>gremlin-core</artifactId>
246+
<version>${tinkerpop.version}</version>
247+
</path>
248+
</annotationProcessorPaths>
249+
</configuration>
250+
</execution>
251+
</executions>
252+
</plugin>
222253
<plugin>
223254
<groupId>org.apache.maven.plugins</groupId>
224255
<artifactId>maven-failsafe-plugin</artifactId>
@@ -229,7 +260,6 @@
229260
<goal>integration-test</goal>
230261
</goals>
231262
<configuration>
232-
<jvm>${testing.jvm}/bin/java</jvm>
233263
<groups>com.datastax.oss.driver.categories.ParallelizableTests</groups>
234264
<parallel>classes</parallel>
235265
<threadCountClasses>8</threadCountClasses>
@@ -246,7 +276,6 @@
246276
<excludedGroups>com.datastax.oss.driver.categories.ParallelizableTests, com.datastax.oss.driver.categories.IsolatedTests</excludedGroups>
247277
<summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary-serial.xml</summaryFile>
248278
<skipITs>${skipSerialITs}</skipITs>
249-
<jvm>${testing.jvm}/bin/java</jvm>
250279
</configuration>
251280
</execution>
252281
<execution>
@@ -262,7 +291,6 @@
262291
<summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary-isolated.xml</summaryFile>
263292
<skipITs>${skipIsolatedITs}</skipITs>
264293
<argLine>${blockhound.argline}</argLine>
265-
<jvm>${testing.jvm}/bin/java</jvm>
266294
</configuration>
267295
</execution>
268296
<execution>

mapper-runtime/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@
122122
<plugin>
123123
<artifactId>maven-surefire-plugin</artifactId>
124124
<configuration>
125-
<jvm>${testing.jvm}/bin/java</jvm>
126125
<threadCount>1</threadCount>
127126
<properties>
128127
<!-- tell TestNG not to run jUnit tests -->

0 commit comments

Comments
 (0)