Skip to content

Commit

Permalink
Merge pull request IQSS#9764 from IQSS/8094-java-17
Browse files Browse the repository at this point in the history
Upgrade to Java 17
  • Loading branch information
kcondon authored Aug 21, 2023
2 parents f82d593 + f0c6778 commit 45a3936
Show file tree
Hide file tree
Showing 73 changed files with 236 additions and 227 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/container_app_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge'
- uses: actions/setup-java@v3
with:
java-version: "11"
java-version: "17"
distribution: 'adopt'
- uses: actions/cache@v3
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/container_app_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 11
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: "11"
java-version: "17"
distribution: temurin
cache: maven

Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: "11"
java-version: "17"
distribution: temurin

# Depending on context, we push to different targets. Login accordingly.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/container_base_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
packages: read
strategy:
matrix:
jdk: [ '11' ]
jdk: [ '17' ]
# Only run in upstream repo - avoid unnecessary runs in forks
if: ${{ github.repository_owner == 'IQSS' }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_beta_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- name: Enable API Session Auth feature flag
working-directory: src/main/resources/META-INF
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/maven_unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,9 @@ jobs:
strategy:
fail-fast: false
matrix:
jdk: [ '11' ]
jdk: [ '17' ]
experimental: [false]
status: ["Stable"]
#
# JDK 17 builds disabled due to non-essential fails marking CI jobs as completely failed within
# Github Projects, PR lists etc. This was consensus on Slack #dv-tech. See issue #8094
# (This is a limitation of how Github is currently handling these things.)
#
#include:
# - jdk: '17'
# experimental: true
# status: "Experimental"
continue-on-error: ${{ matrix.experimental }}
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -68,6 +59,14 @@ jobs:
# We don't want to cache the WAR file, so delete it
- run: rm -rf ~/.m2/repository/edu/harvard/iq/dataverse

# Upload the built war file. For download, it will be wrapped in a ZIP by GitHub.
# See also https://github.com/actions/upload-artifact#zipped-artifact-downloads
- uses: actions/upload-artifact@v3
with:
name: dataverse-java${{ matrix.jdk }}.war
path: target/dataverse*.war
retention-days: 7
push-app-img:
name: Publish App Image
permissions:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/spi_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
Expand All @@ -66,7 +66,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- uses: actions/cache@v2
with:
Expand All @@ -78,7 +78,7 @@ jobs:
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
Expand All @@ -91,4 +91,4 @@ jobs:
env:
MAVEN_USERNAME: ${{ secrets.DATAVERSEBOT_SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.DATAVERSEBOT_SONATYPE_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.DATAVERSEBOT_GPG_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.DATAVERSEBOT_GPG_PASSWORD }}
1 change: 1 addition & 0 deletions doc/release-notes/8094-java-17.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Java 17 or higher is now required.
2 changes: 1 addition & 1 deletion doc/sphinx-guides/source/container/base-image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Image Contents

The base image provides:

- `Eclipse Temurin JRE using Java 11 <https://adoptium.net/temurin/releases?version=11>`_
- `Eclipse Temurin JRE using Java 17 <https://adoptium.net/temurin/releases?version=17>`_
- `Payara Community Application Server <https://docs.payara.fish/community>`_
- CLI tools necessary to run Dataverse (i. e. ``curl`` or ``jq`` - see also :doc:`../installation/prerequisites` in Installation Guide)
- Linux tools for analysis, monitoring and so on
Expand Down
4 changes: 2 additions & 2 deletions doc/sphinx-guides/source/developers/dev-environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ These instructions are oriented around Docker but the "classic" instructions we
Quickstart
----------

First, install Java 11, Maven, and Docker.
First, install Java 17, Maven, and Docker.

After cloning the `dataverse repo <https://github.com/IQSS/dataverse>`_, run this:

Expand All @@ -30,7 +30,7 @@ Detailed Steps
Install Java
~~~~~~~~~~~~

The Dataverse Software requires Java 11.
The Dataverse Software requires Java 17.

On Mac and Windows, we suggest downloading OpenJDK from https://adoptium.net (formerly `AdoptOpenJDK <https://adoptopenjdk.net>`_) or `SDKMAN <https://sdkman.io>`_.

Expand Down
8 changes: 4 additions & 4 deletions doc/sphinx-guides/source/installation/prerequisites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ We assume you plan to run your Dataverse installation on Linux and we recommend
Java
----

The Dataverse Software requires Java SE 11 (or higher).
The Dataverse Software requires Java SE 17 (or higher).

Installing Java
===============
Expand All @@ -30,11 +30,11 @@ The Oracle JDK can be downloaded from http://www.oracle.com/technetwork/java/jav

On a RHEL/derivative, install OpenJDK (devel version) using yum::

# sudo yum install java-11-openjdk
# sudo yum install java-17-openjdk

If you have multiple versions of Java installed, Java 11 should be the default when ``java`` is invoked from the command line. You can test this by running ``java -version``.
If you have multiple versions of Java installed, Java 17 should be the default when ``java`` is invoked from the command line. You can test this by running ``java -version``.

On RHEL/derivative you can make Java 11 the default with the ``alternatives`` command, having it prompt you to select the version of Java from a list::
On RHEL/derivative you can make Java 17 the default with the ``alternatives`` command, having it prompt you to select the version of Java from a list::

# alternatives --config java

Expand Down
2 changes: 2 additions & 0 deletions modules/container-base/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ RUN <<EOF
${ASADMIN} create-jvm-options '-XX\:MetaspaceSize=${ENV=MEM_METASPACE_SIZE}'
${ASADMIN} create-jvm-options '-XX\:MaxMetaspaceSize=${ENV=MEM_MAX_METASPACE_SIZE}'
${ASADMIN} create-jvm-options '-XX\:+IgnoreUnrecognizedVMOptions'
# Workaround for FISH-7722: Failed to deploy war with @Stateless https://github.com/payara/Payara/issues/6337
${ASADMIN} create-jvm-options --add-opens=java.base/java.io=ALL-UNNAMED
# Disable autodeploy and hot reload
${ASADMIN} set configs.config.server-config.admin-service.das-config.dynamic-reload-enabled="false"
${ASADMIN} set configs.config.server-config.admin-service.das-config.autodeploy-enabled="false"
Expand Down
2 changes: 1 addition & 1 deletion modules/dataverse-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
<!-- This is a special Maven property name, do not change! -->
<revision>5.14</revision>

<target.java.version>11</target.java.version>
<target.java.version>17</target.java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<additionalparam>-Xdoclint:none</additionalparam>
<!-- Needed to avoid IDEA IDE compilation failures. See commits in GH #5059 -->
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.4.0</version>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
3 changes: 3 additions & 0 deletions scripts/installer/as-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ function preliminary_setup()

./asadmin $ASADMIN_OPTS create-jvm-options "-Ddataverse.timerServer=true"

# Workaround for FISH-7722: Failed to deploy war with @Stateless https://github.com/payara/Payara/issues/6337
./asadmin $ASADMIN_OPTS create-jvm-options --add-opens=java.base/java.io=ALL-UNNAMED

# enable comet support
./asadmin $ASADMIN_OPTS set server-config.network-config.protocols.protocol.http-listener-1.http.comet-support-enabled="true"

Expand Down
4 changes: 2 additions & 2 deletions scripts/installer/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@
# 1d. check java version
java_version = subprocess.check_output(["java", "-version"], stderr=subprocess.STDOUT).decode()
print("Found java version "+java_version)
if not re.search('(1.8|11)', java_version):
sys.exit("Dataverse requires OpenJDK 1.8 or 11. Please make sure it's in your PATH, and try again.")
if not re.search('(17)', java_version):
sys.exit("Dataverse requires OpenJDK 17. Please make sure it's in your PATH, and try again.")

# 1e. check if the setup scripts - setup-all.sh, are available as well, maybe?
# @todo (?)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@ public String getPublicationDateAsString() {
// So something will need to be modified to accommodate this. -- L.A.
/**
* We call the export format "Schema.org JSON-LD" and extensive Javadoc can
* be found in {@link SchemaDotOrgExporter}.
* be found in {@link edu.harvard.iq.dataverse.export.SchemaDotOrgExporter}.
*/
public String getJsonLd() {
// We show published datasets only for "datePublished" field below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,21 +565,26 @@ private String getDatasetDirectory() throws IOException {
if (isDirectAccess()) {
throw new IOException("No DvObject defined in the Data Access Object");
}

Path datasetDirectoryPath=null;

String authorityForFS = null;
String identifierForFS = null;
if (dvObject instanceof Dataset) {
datasetDirectoryPath = Paths.get(this.getDataset().getAuthorityForFileStorage(), this.getDataset().getIdentifierForFileStorage());
authorityForFS = this.getDataset().getAuthorityForFileStorage();
identifierForFS = this.getDataset().getIdentifierForFileStorage();
} else if (dvObject instanceof DataFile) {
datasetDirectoryPath = Paths.get(this.getDataFile().getOwner().getAuthorityForFileStorage(), this.getDataFile().getOwner().getIdentifierForFileStorage());
authorityForFS = this.getDataFile().getOwner().getAuthorityForFileStorage();
identifierForFS = this.getDataFile().getOwner().getIdentifierForFileStorage();
} else if (dvObject instanceof Dataverse) {
throw new IOException("FileAccessIO: Dataverses are not a supported dvObject");
}
if (datasetDirectoryPath == null) {

if (authorityForFS == null || identifierForFS == null) {
throw new IOException("Could not determine the filesystem directory of the parent dataset.");
}
String datasetDirectory = Paths.get(getFilesRootDirectory(), datasetDirectoryPath.toString()).toString();

// Determine the final directory tree. As of JDK 16, the first component of the path MUST be non-null
// (we check for that via the setting), but also the others make no sense if they are null.
String datasetDirectory = Paths.get(getFilesRootDirectory(), authorityForFS, identifierForFS).toString();

if (dvObject.getStorageIdentifier() == null || dvObject.getStorageIdentifier().isEmpty()) {
throw new IOException("Data Access: No local storage identifier defined for this datafile.");
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/edu/harvard/iq/dataverse/api/AccessIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
*/
package edu.harvard.iq.dataverse.api;

import com.jayway.restassured.RestAssured;
import static com.jayway.restassured.RestAssured.given;
import com.jayway.restassured.path.json.JsonPath;
import com.jayway.restassured.response.Response;
import io.restassured.RestAssured;
import static io.restassured.RestAssured.given;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import edu.harvard.iq.dataverse.DataFile;
import edu.harvard.iq.dataverse.util.FileUtil;
import java.io.IOException;
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/edu/harvard/iq/dataverse/api/AdminIT.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package edu.harvard.iq.dataverse.api;

import com.jayway.restassured.RestAssured;
import com.jayway.restassured.path.json.JsonPath;
import com.jayway.restassured.response.Response;
import io.restassured.RestAssured;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import edu.harvard.iq.dataverse.DataFile;
import edu.harvard.iq.dataverse.authorization.providers.builtin.BuiltinAuthenticationProvider;
import edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.GitHubOAuth2AP;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package edu.harvard.iq.dataverse.api;

import com.jayway.restassured.RestAssured;
import com.jayway.restassured.path.json.JsonPath;
import com.jayway.restassured.response.Response;
import io.restassured.RestAssured;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/edu/harvard/iq/dataverse/api/BagIT.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package edu.harvard.iq.dataverse.api;

import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
import io.restassured.RestAssured;
import io.restassured.response.Response;
import edu.harvard.iq.dataverse.engine.command.impl.LocalSubmitToArchiveCommand;
import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
import static jakarta.ws.rs.core.Response.Status.CREATED;
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/edu/harvard/iq/dataverse/api/BatchImportIT.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package edu.harvard.iq.dataverse.api;

import com.jayway.restassured.RestAssured;
import com.jayway.restassured.path.json.JsonPath;
import io.restassured.RestAssured;
import io.restassured.path.json.JsonPath;
import java.io.File;
import com.jayway.restassured.response.Response;
import io.restassured.response.Response;
import java.util.logging.Logger;
import org.junit.BeforeClass;
import org.junit.Test;
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/edu/harvard/iq/dataverse/api/BuiltinUsersIT.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package edu.harvard.iq.dataverse.api;

import com.jayway.restassured.RestAssured;
import static com.jayway.restassured.RestAssured.given;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.path.json.JsonPath;
import com.jayway.restassured.response.Response;
import io.restassured.RestAssured;
import static io.restassured.RestAssured.given;
import io.restassured.http.ContentType;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import edu.harvard.iq.dataverse.api.auth.ApiKeyAuthMechanism;
import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
import java.util.AbstractMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package edu.harvard.iq.dataverse.api;

import com.jayway.restassured.RestAssured;
import static com.jayway.restassured.RestAssured.given;
import com.jayway.restassured.path.json.JsonPath;
import com.jayway.restassured.response.Response;
import io.restassured.RestAssured;
import static io.restassured.RestAssured.given;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.util.logging.Logger;
import static junit.framework.Assert.assertEquals;
import org.junit.BeforeClass;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/edu/harvard/iq/dataverse/api/DataCiteIT.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package edu.harvard.iq.dataverse.api;

import com.jayway.restassured.path.json.JsonPath;
import com.jayway.restassured.response.Response;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import static junit.framework.Assert.assertEquals;
import static org.hamcrest.CoreMatchers.equalTo;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package edu.harvard.iq.dataverse.api;

import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
import io.restassured.RestAssured;
import io.restassured.response.Response;
import edu.harvard.iq.dataverse.api.auth.ApiKeyAuthMechanism;
import org.junit.BeforeClass;
import org.junit.Test;
Expand Down
Loading

0 comments on commit 45a3936

Please sign in to comment.