From 9b16fd937af414db6980ee244d2cf0540038bd02 Mon Sep 17 00:00:00 2001 From: Martijn Verburg Date: Thu, 3 Oct 2024 10:36:57 +1300 Subject: [PATCH 1/7] Add mvnw --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 150b6d2f2..f9043ff71 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ data .DS_Store cargo-tracker-test-data nbactions.xml +.java-version From a9c1af3b9d6e84f17eb34f172c4995773013076d Mon Sep 17 00:00:00 2001 From: Martijn Verburg Date: Thu, 3 Oct 2024 13:50:47 +1300 Subject: [PATCH 2/7] Updated Build dependencies and plugins, all profiles build, test and run correctly, mvn site now also supported --- .mvn/wrapper/maven-wrapper.properties | 19 ++ mvnw | 259 +++++++++++++++ mvnw.cmd | 149 +++++++++ pmd-ruleset.xml | 180 +++++++++++ pom.xml | 433 ++++++++++++++++++++++++-- spotbugs-excludes.xml | 12 + 6 files changed, 1032 insertions(+), 20 deletions(-) create mode 100644 .mvn/wrapper/maven-wrapper.properties create mode 100755 mvnw create mode 100644 mvnw.cmd create mode 100644 pmd-ruleset.xml create mode 100644 spotbugs-excludes.xml diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 000000000..d58dfb70b --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,19 @@ +# 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. +wrapperVersion=3.3.2 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip diff --git a/mvnw b/mvnw new file mode 100755 index 000000000..19529ddf8 --- /dev/null +++ b/mvnw @@ -0,0 +1,259 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.2 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 000000000..b150b91ed --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,149 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.2 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' +$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" +if ($env:MAVEN_USER_HOME) { + $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" +} +$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/pmd-ruleset.xml b/pmd-ruleset.xml new file mode 100644 index 000000000..ab72e122b --- /dev/null +++ b/pmd-ruleset.xml @@ -0,0 +1,180 @@ + + + + + + PMD rules customised for gctoolkit code. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 3444c3110..b0f8fc311 100644 --- a/pom.xml +++ b/pom.xml @@ -19,27 +19,64 @@ https://github.com/eclipse-ee4j/cargotracker/issues + 10.18.2 + 10.0.0 + 3.1.0 + 1.10.15 + 2.12.1 + 3.5.0 + 3.4.0 + 3.13.0 + 11 + 3.8.0 + 3.1.3 + 1.0 + 3.5.0 + 3.4.1 + 3.1.3 + 0.8.12 + 3.4.2 + 3.10.1 + 3.5.0 + 2.4.0 + + 3.21.2 + 3.7.0 + 0.16.1 + 3.3.1 + 4.0.0-M16 + 3.3.1 + 4.8.6.4 + 3.5.0 + 3.4.0 + 3.9.9 + 2.17.1 + 0.9.1 + + 6.55.0 UTF-8 + eclipse-ee4j/cargotracker UTF-8 - 11 - 10.0.0 + git@github.com:${project.github.repository}.git + 4.8.6 + org.jboss.arquillian arquillian-bom - 1.7.1.Final + 1.7.2.Final import pom org.junit junit-bom - 5.10.0 + 5.11.1 pom import @@ -57,6 +94,7 @@ org.apache.commons commons-lang3 + org.primefaces primefaces @@ -69,6 +107,7 @@ junit-jupiter test + org.hamcrest hamcrest @@ -78,7 +117,7 @@ org.assertj assertj-core - 3.24.2 + 3.26.3 test @@ -89,6 +128,7 @@ + org.jboss.shrinkwrap.resolver shrinkwrap-resolver-impl-maven @@ -109,28 +149,379 @@ cargo-tracker + + + + com.github.spotbugs + spotbugs-maven-plugin + ${maven.spotbugs-plugin.version} + + + com.github.spotbugs + spotbugs + ${spotbugs.version} + + + + spotbugs-excludes.xml + + + + org.apache.maven.plugins + maven-changes-plugin + ${maven.changes-plugin.version} + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${maven.checkstyle-plugin.version} + + + com.puppycrawl.tools + checkstyle + ${checkstyle.version} + + + + + org.apache.maven.plugins + maven-clean-plugin + ${maven.clean-plugin.version} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler-plugin.version} + + {maven.compiler.release} + {maven.compiler.release} + + + + org.apache.maven.plugins + maven-dependency-plugin + ${maven.dependency-plugin.version} + + + org.apache.maven.plugins + maven-deploy-plugin + ${maven.deploy-plugin.version} + + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven.enforcer-plugin.version} + + + enforce-maven + + enforce + + + + + ${maven.version} + + + + + + + + org.apache.maven.plugins + maven-install-plugin + ${maven.install-plugin.version} + + + org.apache.maven.plugins + maven-jar-plugin + ${maven.jar-plugin.version} + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven.javadoc-plugin.version} + + + org.apache.maven.plugins + maven-jxr-plugin + ${maven.jxr-plugin.version} + + + org.apache.maven.plugins + maven-pmd-plugin + ${maven.pmd-plugin.version} + + + net.sourceforge.pmd + pmd-core + ${pmd.version} + + + net.sourceforge.pmd + pmd-java + ${pmd.version} + + + net.sourceforge.pmd + pmd-javascript + ${pmd.version} + + + net.sourceforge.pmd + pmd-jsp + ${pmd.version} + + + + + org.apache.maven.plugins + maven-source-plugin + ${maven.source-plugin.version} + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire-plugin.version} + + + org.apache.maven.plugins + maven-site-plugin + ${maven.site-plugin.version} + + + org.apache.maven.plugins + maven-project-info-reports-plugin + ${maven.project-info-reports-plugin.version} + + + org.apache.maven.plugins + maven-resources-plugin + ${maven.resources-plugin.version} + + + org.apache.maven.plugins + maven-antrun-plugin + ${maven.antrun-plugin.version} + + + org.apache.rat + apache-rat-plugin + ${maven.rat-plugin.version} + + + validate + + check + + + + gclogs/** + + + + + + + org.codehaus.mojo + exec-maven-plugin + ${maven.exec-plugin.version} + + + org.codehaus.mojo + license-maven-plugin + ${maven.license-plugin.version} + + + org.codehaus.mojo + versions-maven-plugin + ${maven.versions-plugin.version} + + + org.commonjava.maven.plugins + directory-maven-plugin + ${maven.directory-maven-plugin.version} + + + org.jacoco + jacoco-maven-plugin + ${maven.jacoco-plugin.version} + + + + prepare-agent + + + + report + prepare-package + + report + + + + + + + + com.github.spotbugs + spotbugs-maven-plugin + org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + + + org.apache.maven.plugins + maven-enforcer-plugin + + + org.apache.maven.plugins + maven-javadoc-plugin org.apache.maven.plugins maven-resources-plugin - 3.3.1 + + + org.apache.maven.plugins + maven-source-plugin org.apache.maven.plugins maven-war-plugin - 3.4.0 + ${maven.war-plugin.version} false true + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.7.0 + true + + ossrh + https://oss.sonatype.org/ + false + 10 + + + + org.hjug.refactorfirst.plugin + refactor-first-maven-plugin + 0.6.0 + + + true + + + + + + + com.github.spotbugs + spotbugs-maven-plugin + + + + org.mutabilitydetector + MutabilityDetector4FindBugs + ${mutability.detector.version} + + + + + + org.apache.maven.plugins + maven-changes-plugin + + + https + 443 + false + false + + + + + changes-report + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + + checkstyle + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + org.apache.maven.plugins + maven-jxr-plugin + + + org.apache.maven.plugins + maven-pmd-plugin + + ${maven.compiler.release} + + + pmd-ruleset.xml + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + + + org.apache.rat + apache-rat-plugin + + + org.codehaus.mojo + license-maven-plugin + + + org.codehaus.mojo + versions-maven-plugin + + + + dependency-updates-report + plugin-updates-report + property-updates-report + + + + + + org.jacoco + jacoco-maven-plugin + ${maven.jacoco-plugin.version} + + + org.hjug.refactorfirst.plugin + refactor-first-maven-plugin + + + @@ -139,6 +530,7 @@ true + 6.2024.6 http://localhost:8080/cargo-tracker/rest/graph-traversal/shortest-path @@ -190,12 +582,12 @@ org.apache.maven.plugins maven-surefire-plugin - 3.1.2 + ${maven.surefire-plugin.version} org.codehaus.cargo cargo-maven3-plugin - 1.10.9 + ${maven.cargo-plugin.version} payara @@ -214,11 +606,11 @@ glassfish - 7.0.15 + 7.0.17 http://localhost:8080/cargo-tracker/rest/graph-traversal/shortest-path org.h2.jdbcx.JdbcDataSource - jdbc:h2:file:./cargo-tracker-data/cargo-tracker-database @@ -233,6 +625,7 @@ provided + com.h2database h2 @@ -262,7 +655,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.1.2 + ${maven.surefire-plugin.version} glassfish @@ -275,7 +668,7 @@ org.codehaus.cargo cargo-maven3-plugin - 1.10.9 + ${maven.cargo-plugin.version} glassfish7x @@ -292,7 +685,7 @@ org.apache.maven.plugins maven-dependency-plugin - 3.6.0 + ${maven.dependency-plugin.version} unpack @@ -318,7 +711,7 @@ maven-antrun-plugin - 3.1.0 + ${maven.antrun-plugin.version} process-test-classes @@ -392,7 +785,7 @@ org.apache.maven.plugins maven-dependency-plugin - 3.6.0 + ${maven.dependency-plugin.version} copy @@ -418,7 +811,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.1.2 + ${maven.surefire-plugin.version} @@ -463,7 +856,7 @@ io.openliberty.tools liberty-maven-plugin - 3.8.2 + 3.10.3 @@ -489,7 +882,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.1.2 + ${maven.surefire-plugin.version} openliberty diff --git a/spotbugs-excludes.xml b/spotbugs-excludes.xml new file mode 100644 index 000000000..8ae251fd2 --- /dev/null +++ b/spotbugs-excludes.xml @@ -0,0 +1,12 @@ + + + + + + + + + From 994517715ed66321d0ad7c2fbd339a73c985cf16 Mon Sep 17 00:00:00 2001 From: Martijn Verburg Date: Thu, 3 Oct 2024 13:58:47 +1300 Subject: [PATCH 3/7] Updated core app dependencies, everything passes --- pom.xml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index b0f8fc311..aa2e41f0d 100644 --- a/pom.xml +++ b/pom.xml @@ -65,11 +65,10 @@ - org.jboss.arquillian arquillian-bom - 1.7.2.Final + 1.9.1.Final import pom @@ -93,12 +92,12 @@ org.apache.commons commons-lang3 + 3.17.0 - org.primefaces primefaces - 12.0.0 + 14.0.5 jakarta @@ -111,7 +110,7 @@ org.hamcrest hamcrest - 2.2 + 3.0 test @@ -124,26 +123,28 @@ org.jboss.arquillian.junit5 arquillian-junit5-container + 1.7.1.Final test - org.jboss.shrinkwrap.resolver shrinkwrap-resolver-impl-maven - 3.1.4 + 3.3.1 test org.jboss.arquillian.protocol arquillian-protocol-servlet-jakarta test + 1.7.1.Final org.slf4j slf4j-simple + 2.0.16 test From 88218b882849d416aab3147f29d4b5ef52c507c7 Mon Sep 17 00:00:00 2001 From: Martijn Verburg Date: Thu, 3 Oct 2024 19:58:08 +1300 Subject: [PATCH 4/7] Updated all dependencies as far as they will go without failures --- pom.xml | 60 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index aa2e41f0d..29ae7f063 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,8 @@ https://github.com/eclipse-ee4j/cargotracker/issues + + 1.7.2.Final 10.18.2 10.0.0 3.1.0 @@ -68,7 +70,7 @@ org.jboss.arquillian arquillian-bom - 1.9.1.Final + ${arquillian.version} import pom @@ -106,7 +108,6 @@ junit-jupiter test - org.hamcrest hamcrest @@ -123,22 +124,23 @@ org.jboss.arquillian.junit5 arquillian-junit5-container - 1.7.1.Final + ${arquillian.version} test + org.jboss.shrinkwrap.resolver shrinkwrap-resolver-impl-maven - 3.3.1 + 3.1.4 test org.jboss.arquillian.protocol arquillian-protocol-servlet-jakarta test - 1.7.1.Final + ${arquillian.version} @@ -451,7 +453,10 @@ changes-report - + @@ -531,12 +536,11 @@ true - - 6.2024.6 + 6.2024.9 http://localhost:8080/cargo-tracker/rest/graph-traversal/shortest-path org.h2.jdbcx.JdbcDataSource - jdbc:h2:file:./cargo-tracker-data/cargo-tracker-database @@ -547,14 +551,14 @@ org.glassfish.jersey.core jersey-server - 3.1.2 + 3.1.8 provided com.h2database h2 - 2.2.224 + 2.3.232 runtime @@ -567,14 +571,14 @@ fish.payara.arquillian arquillian-payara-micro-managed - 3.0.alpha8 + 3.1 test fish.payara.arquillian payara-client-ee9 - 3.0.alpha8 + 3.1 test @@ -607,7 +611,7 @@ glassfish - 7.0.17 + 7.0.18 http://localhost:8080/cargo-tracker/rest/graph-traversal/shortest-path org.h2.jdbcx.JdbcDataSource @@ -622,15 +626,14 @@ org.glassfish.jersey.core jersey-server - 3.1.2 + 3.1.8 provided - com.h2database h2 - 2.2.224 + 2.3.232 runtime @@ -647,7 +650,7 @@ org.glassfish.jersey.inject jersey-hk2 - 3.1.3 + 3.1.8 test @@ -730,21 +733,24 @@ - + cloud false - 6.2024.6 + 6.2024.9 http://localhost:8080/rest/graph-traversal/shortest-path org.postgresql.ds.PGPoolingDataSource + ${postgreSqlJdbcUrl} + ${postgreSqlUsername} + ${postgreSqlPassword} @@ -752,14 +758,14 @@ org.glassfish.jersey.core jersey-server - 3.1.2 + 3.1.8 provided com.h2database h2 - 2.2.224 + 2.3.232 test @@ -771,13 +777,13 @@ fish.payara.arquillian arquillian-payara-micro-managed - 3.0.alpha8 + 3.1 test fish.payara.arquillian payara-client-ee9 - 3.0.alpha8 + 3.1 test @@ -801,7 +807,7 @@ org.postgresql postgresql - 42.6.0 + 42.7.4 true ${project.build.directory} postgresql.jar @@ -833,13 +839,13 @@ org.hsqldb hsqldb - 2.7.2 + 2.7.3 provided org.glassfish.jersey.core jersey-server - 3.1.2 + 3.1.8 provided From 7f7d6d93970690836a8166d8b07b584a3bd19da2 Mon Sep 17 00:00:00 2001 From: Martijn Verburg Date: Fri, 4 Oct 2024 09:18:54 +1300 Subject: [PATCH 5/7] Properly bind jacoco and refactor first to reporting, also fix github workflows to use mvnw --- .github/workflows/main.yml | 2 +- .github/workflows/nightly.yml | 8 +++--- pom.xml | 49 ++++++++++++++++++++++++----------- 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f700bee95..c8ca3d1a3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,4 +46,4 @@ jobs: restore-keys: ${{ runner.os }}-m2 - name: Build with Maven - run: mvn clean package --file pom.xml + run: ./mvnw clean package --file pom.xml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b3198a7e2..29049d263 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -25,13 +25,13 @@ jobs: restore-keys: ${{ runner.os }}-m2 - name: Build with Payara - run: mvn clean package --file pom.xml + run: ./mvnw clean package --file pom.xml - name: Build with GlassFish - run: mvn clean package -Pglassfish --file pom.xml + run: ./mvnw clean package -Pglassfish --file pom.xml - name: Build with Open Liberty - run: mvn clean package -Popenliberty --file pom.xml + run: ./mvnw clean package -Popenliberty --file pom.xml - name: Build for the cloud - run: mvn clean package -Pcloud -DpostgreSqlJdbcUrl="jdbc:postgresql://postgres:5432/postgres" -DpostgreSqlUsername="${{ secrets.POSTGRES_USER }}" -DpostgreSqlPassword="${{ secrets.POSTGRES_PASSWORD }}" --file pom.xml \ No newline at end of file + run: ./mvnw clean package -Pcloud -DpostgreSqlJdbcUrl="jdbc:postgresql://postgres:5432/postgres" -DpostgreSqlUsername="${{ secrets.POSTGRES_USER }}" -DpostgreSqlPassword="${{ secrets.POSTGRES_PASSWORD }}" --file pom.xml \ No newline at end of file diff --git a/pom.xml b/pom.xml index 29ae7f063..458aceb26 100644 --- a/pom.xml +++ b/pom.xml @@ -349,20 +349,6 @@ org.jacoco jacoco-maven-plugin ${maven.jacoco-plugin.version} - - - - prepare-agent - - - - report - prepare-package - - report - - - @@ -421,6 +407,32 @@ true + + org.jacoco + jacoco-maven-plugin + ${maven.jacoco-plugin.version} + + + initialize + + prepare-agent + + + + report + prepare-package + + report + + + + default-check + + check + + + + @@ -520,7 +532,14 @@ org.jacoco jacoco-maven-plugin - ${maven.jacoco-plugin.version} + + + + + report + + + org.hjug.refactorfirst.plugin From d79d6bb8edc3e613c6cdc1e48d9d88cf1f4eebf7 Mon Sep 17 00:00:00 2001 From: Martijn Verburg Date: Sun, 6 Oct 2024 10:33:57 +1300 Subject: [PATCH 6/7] Do not enforce maven version --- pom.xml | 11 +++++------ .../internal/DefaultHandlingEventService.java | 2 +- .../cargotracker/domain/model/cargo/Cargo.java | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 458aceb26..669c3fe5e 100644 --- a/pom.xml +++ b/pom.xml @@ -210,6 +210,8 @@ maven-deploy-plugin ${maven.deploy-plugin.version} + + org.apache.maven.plugins maven-install-plugin @@ -361,10 +364,12 @@ org.apache.maven.plugins maven-compiler-plugin + org.apache.maven.plugins maven-javadoc-plugin @@ -425,12 +430,6 @@ report - - default-check - - check - - diff --git a/src/main/java/org/eclipse/cargotracker/application/internal/DefaultHandlingEventService.java b/src/main/java/org/eclipse/cargotracker/application/internal/DefaultHandlingEventService.java index a453eec71..3fc9de486 100644 --- a/src/main/java/org/eclipse/cargotracker/application/internal/DefaultHandlingEventService.java +++ b/src/main/java/org/eclipse/cargotracker/application/internal/DefaultHandlingEventService.java @@ -34,7 +34,7 @@ public void registerHandlingEvent( /* * Using a factory to create a HandlingEvent (aggregate). This is where it is - * determined wether the incoming data, the attempt, actually is capable of + * determined whether the incoming data, the attempt, actually is capable of * representing a real handling event. */ HandlingEvent event = diff --git a/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Cargo.java b/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Cargo.java index 9e924a78a..9d7ebdc7e 100644 --- a/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Cargo.java +++ b/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Cargo.java @@ -39,15 +39,15 @@ * the cargo is contained in the Delivery value object, which is replaced whenever a cargo is * handled by an asynchronous event triggered by the registration of the handling event. * - *

The delivery can also be affected by routing changes, i.e. when a the route specification + *

The delivery can also be affected by routing changes, i.e. when the route specification * changes, or the cargo is assigned to a new route. In that case, the delivery update is performed * synchronously within the cargo aggregate. * *

The life cycle of a cargo ends when the cargo is claimed by the customer. * *

The cargo aggregate, and the entire domain model, is built to solve the problem of booking and - * tracking cargo. All important business rules for determining whether or not a cargo is - * misdirected, what the current status of the cargo is (on board carrier, in port etc), are + * tracking cargo. All important business rules for determining whether a cargo is + * misdirected, what the current status of the cargo is (on board carrier, in port etc.), are * captured in this aggregate. */ @Entity From b695e238653014ab44455183f4a1aa06291c0023 Mon Sep 17 00:00:00 2001 From: Martijn Verburg Date: Mon, 14 Oct 2024 17:32:12 +1300 Subject: [PATCH 7/7] Fixes after review --- README.md | 70 +++++++++++++++++++++++++++++++---------------------- nightly.yml | 2 +- pom.xml | 58 ++++++++++++++------------------------------ 3 files changed, 60 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 8d412b8a5..db2d91399 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,16 @@ # Eclipse Cargo Tracker - Applied Domain-Driven Design Blueprints for Jakarta EE -The project demonstrates how you can develop applications with Jakarta EE using widely adopted architectural best practices like Domain-Driven -Design (DDD). The project is based on the well-known [Java DDD sample application](https://github.com/citerus/dddsample-core) developed by DDD pioneer Eric Evans' company Domain Language and the Swedish -software consulting company Citerus. The cargo example actually comes from -Eric Evans' seminal book on DDD. +The project demonstrates how you can develop applications with Jakarta EE using widely adopted architectural best +practices like Domain-Driven Design (DDD). The project is based on the well-known [Java DDD sample application](https://github.com/citerus/dddsample-core) +developed by DDD pioneer Eric Evans' company Domain Language and the Swedish software consulting company Citerus. +The cargo example actually comes from Eric Evans' seminal book on DDD. The application is an end-to-end system for keeping track of shipping cargo. It has several interfaces described in the following sections. For further details on the project, please visit: https://eclipse-ee4j.github.io/cargotracker/. -A slide deck introducing the -fundamentals of the project is available on the official Eclipse +A slide deck introducing the fundamentals of the project is available on the official Eclipse Foundation [Jakarta EE SlideShare account](https://www.slideshare.net/Jakarta_EE/applied-domaindriven-design-blueprints-for-jakarta-ee). A recording of the slide deck is available on the official [Jakarta EE YouTube account](https://www.youtube.com/watch?v=pKmmZd-3mhA). ![Eclipse Cargo Tracker cover](cargo_tracker_cover.png) @@ -25,29 +24,30 @@ The simplest steps are the following (no IDE required): * Get the project source code. * Ensure you are running Java SE 11 or Java SE 17. * Make sure JAVA_HOME is set. -* As long as you have Maven set up properly, navigate to the project source root and type: +* Navigate to the project source root and type: ``` -mvn clean package cargo:run +./mvnw clean package cargo:run ``` * Go to http://localhost:8080/cargo-tracker -This will run the application with Payara Server by default. The project also has Maven profiles to support GlassFish and Open Liberty. For example you can run using GlassFish using the following command: +This will run the application with Payara Server by default. The project also has Maven profiles to support GlassFish +and Open Liberty. For example, you can run using GlassFish using the following command: ``` -mvn clean package -Pglassfish cargo:run +./mvnw clean package -Pglassfish cargo:run ``` -Similarly you can run using Open Liberty using the following command: +Similarly, you can run using Open Liberty using the following command: ``` -mvn clean package -Popenliberty liberty:run +./mvnw clean package -Popenliberty liberty:run ``` To set up in Visual Studio Code, follow these steps: * Set up Java SE 11, or Java SE 17, [Visual Studio Code](https://code.visualstudio.com/download) and [Payara 6](https://www.payara.fish/downloads/payara-platform-community-edition/). You will also need to set up the [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) and [Payara Tools](https://marketplace.visualstudio.com/items?itemName=Payara.payara-vscode) in Visual Studio Code. * Make sure JAVA_HOME is set. -* Open the directory that contains the code in Visual Studio Code. Visual Studio Code will do the rest for you, it will automatically configure a Maven project. Proceed with clean/building the application. +* Open the directory that contains the code in Visual Studio Code. Visual Studio Code will do the rest for you, it should automatically configure a Maven project. Proceed with clean/building the application. * After the project is built (which will take a while the very first time as Maven downloads dependencies), simply run the generated `cargo-tracker.war` file under the `target` directory using Payara Tools. You can similarly use GlassFish or Open Liberty in Visual Studio Code. @@ -62,8 +62,8 @@ There are several web interfaces, REST interfaces and a file system scanning interface. It's probably best to start exploring the interfaces in the rough order below. -The tracking interface let's you track the status of cargo and is -intended for the general public. Try entering a tracking ID like ABC123 (the +The tracking interface lets you track the status of cargo and is +intended for the public. Try entering a tracking ID like ABC123 (the application is pre-populated with some sample data). The administrative interface is intended for the shipping company that manages @@ -76,29 +76,34 @@ also change the destination for cargo if needed or track cargo. The Handling Event Logging interface is intended for port personnel registering what happened to cargo. The interface is primarily intended for mobile devices, but -you can use it via a desktop browser. The interface is accessible at this URL: http://localhost:8080/cargo-tracker/event-logger/index.xhtml. For convenience, you +you can use it via a desktop browser. The interface is accessible at this URL: +http://localhost:8080/cargo-tracker/event-logger/index.xhtml. For convenience, you could use a mobile emulator instead of an actual mobile device. Generally speaking cargo goes through these events: * It's received at the origin location. -* It's loaded and unloaded onto voyages on it's itinerary. -* It's claimed at it's destination location. +* It's loaded and unloaded onto voyages on its itinerary. +* It's claimed at its destination location. * It may go through customs at arbitrary points. -While filling out the event registration form, it's best to have the itinerary -handy. You can access the itinerary for registered cargo via the admin interface. The cargo handling is done via Messaging for scalability. While using the event logger, note that only the load and unload events require as associated voyage. +While filling out the event registration form, it's best to have the itinerary handy. You can access the itinerary for +registered cargo via the admin interface. The cargo handling is done via Messaging for scalability. While using the +event logger, note that only the load and unload events require as associated voyage. You should also explore the file system based bulk event registration interface. It reads files under /tmp/uploads. The files are just CSV files. A sample CSV -file is available under [src/test/sample/handling_events.csv](src/test/sample/handling_events.csv). The sample is already set up to match the remaining itinerary events for cargo ABC123. Just make sure to update the times in the first column of the sample CSV file to match the itinerary as well. +file is available under [src/test/sample/handling_events.csv](src/test/sample/handling_events.csv). The sample is already set up to match the remaining +itinerary events for cargo ABC123. Just make sure to update the times in the first column of the sample CSV file to +match the itinerary as well. -Sucessfully processed entries are archived under /tmp/archive. Any failed records are +Successfully processed entries are archived under /tmp/archive. Any failed records are archived under /tmp/failed. Don't worry about making mistakes. The application is intended to be fairly error tolerant. If you do come across issues, you should [report them](https://github.com/eclipse-ee4j/cargotracker/issues). -You can simply remove ./cargo-tracker-data from the file system to restart fresh. This directory will typically be under $your-payara-installation/glassfish/domains/domain1/config. +You can simply remove ./cargo-tracker-data from the file system to restart fresh. This directory will typically be +under $your-payara-installation/glassfish/domains/domain1/config. You can also use the soapUI scripts included in the source code to explore the REST interfaces as well as the numerous unit tests covering the code base @@ -117,8 +122,8 @@ approach to software design and development that focuses on the core domain and domain logic. For the most part, it's fine if you are new to Jakarta EE. As long as you have a -basic understanding of server-side applications, the code should be good enough to get started. For learning Jakarta EE further, -we have recommended a few links in the resources section of the project site. Of +basic understanding of server-side applications, the code should be good enough to get started. For learning Jakarta EE +further, we have recommended a few links in the resources section of the project site. Of course, the ideal user of the project is someone who has a basic working understanding of both Jakarta EE and DDD. Though it's not our goal to become a kitchen sink example for demonstrating the vast amount of APIs and features in Jakarta EE, @@ -126,7 +131,10 @@ we do use a very representative set. You'll find that you'll learn a fair amount by simply digging into the code to see how things are implemented. ## Cloud Demo -Cargo Tracker is deployed to Kubernetes on the cloud using GitHub Actions workflows. You can find the demo deployment on the Scaleforce cloud (https://cargo-tracker.j.scaleforce.net). This project is very thankful to our sponsors [Jelastic](https://jelastic.com) and [Scaleforce](https://www.scaleforce.net) for hosting the demo! The deployment and all data is refreshed nightly. On the cloud Cargo Tracker uses PostgreSQL as the database. The [GitHub Container Registry](https://ghcr.io/eclipse-ee4j/cargo-tracker) is used to publish Docker images. +Cargo Tracker is deployed to Kubernetes on the cloud using GitHub Actions workflows. You can find the demo deployment on +the Scaleforce cloud (https://cargo-tracker.j.scaleforce.net). This project is very thankful to our sponsors [Jelastic](https://jelastic.com) +and [Scaleforce](https://www.scaleforce.net) for hosting the demo! The deployment and all the data is refreshed nightly. On the cloud Cargo Tracker +uses PostgreSQL as the database. The [GitHub Container Registry](https://ghcr.io/eclipse-ee4j/cargo-tracker) is used to publish Docker images. ## Jakarta EE 8 A Jakarta EE 8, Java SE 8, Payara 5 version of Cargo Tracker is available under the ['jakartaee8' branch](https://github.com/eclipse-ee4j/cargotracker/tree/jakartaee8). @@ -135,9 +143,13 @@ A Jakarta EE 8, Java SE 8, Payara 5 version of Cargo Tracker is available under A Java EE 7, Java SE 8, Payara 4.1 version of Cargo Tracker is available under the ['javaee7' branch](https://github.com/eclipse-ee4j/cargotracker/tree/javaee7). ## Contributing -This project complies with the Google Style Guides for [Java](https://google.github.io/styleguide/javaguide.html), [JavaScript](https://google.github.io/styleguide/jsguide.html), and [HTML/CSS](https://google.github.io/styleguide/htmlcssguide.html). You can use the [google-java-format](https://github.com/google/google-java-format) tool to help you comply with the Google Java Style Guide. You can use the tool with most major IDEs such as Eclipse, Visual Studio Code, and IntelliJ. +This project complies with the Google Style Guides for [Java](https://google.github.io/styleguide/javaguide.html), [JavaScript](https://google.github.io/styleguide/jsguide.html), and [HTML/CSS](https://google.github.io/styleguide/htmlcssguide.html). +You can use the [google-java-format](https://github.com/google/google-java-format) tool to help you comply with the Google Java Style Guide. You can use the +tool with most major IDEs such as Eclipse, Visual Studio Code, and IntelliJ. -In general for all files we use a column/line width of 80 whenever possible and we use 2 spaces for indentation. All files must end with a new line. Please adjust the formatting settings of your IDE accordingly. You are encouraged but not required to use HTML Tidy and CSS Tidy to help format your code. +In general for all files we use a column/line width of 80 whenever possible, and we use 2 spaces for indentation. +All files must end with a new line. Please adjust the formatting settings of your IDE accordingly. You are encouraged +but not required to use HTML Tidy and CSS Tidy to help format your code. For further guidance on contributing including the project roadmap, please look [here](CONTRIBUTING.md). @@ -150,7 +162,7 @@ For further guidance on contributing including the project roadmap, please look explained [here](https://github.com/payara/Payara/issues/3038). * If you restart the application a few times, you will run into a bug causing a spurious deployment failure. While the problem can be annoying, it's harmless. Just re-run the application (make sure to completely un-deploy the application and shut down Payara first). * Sometimes when the server is not shut down correctly or there is a locking/permissions issue, the H2 database that - the application uses get's corrupted, resulting in strange database errors. If + the application uses gets corrupted, resulting in strange database errors. If this occurs, you will need to stop the application and clean the database. You can do this by simply removing the cargo-tracker-data directory from the file system and restarting the application. This directory will typically be under $your-payara-installation/glassfish/domains/domain1/config. diff --git a/nightly.yml b/nightly.yml index e7d63ef3f..cd6f09585 100644 --- a/nightly.yml +++ b/nightly.yml @@ -56,7 +56,7 @@ jobs: restore-keys: ${{ runner.os }}-m2 - name: Build with Maven - run: mvn clean package -Pcloud -DpostgreSqlJdbcUrl="jdbc:postgresql://postgres:5432/postgres" -DpostgreSqlUsername="${{ secrets.POSTGRES_USER }}" -DpostgreSqlPassword="${{ secrets.POSTGRES_PASSWORD }}" --file pom.xml + run: ./mvnw clean package -Pcloud -DpostgreSqlJdbcUrl="jdbc:postgresql://postgres:5432/postgres" -DpostgreSqlUsername="${{ secrets.POSTGRES_USER }}" -DpostgreSqlPassword="${{ secrets.POSTGRES_PASSWORD }}" --file pom.xml - name: Login to GitHub Container Registry uses: docker/login-action@v2 diff --git a/pom.xml b/pom.xml index 669c3fe5e..3988010b4 100644 --- a/pom.xml +++ b/pom.xml @@ -18,11 +18,16 @@ github https://github.com/eclipse-ee4j/cargotracker/issues + 1.7.2.Final 10.18.2 - 10.0.0 + 5.11.2 3.1.0 1.10.15 2.12.1 @@ -33,7 +38,6 @@ 3.8.0 3.1.3 1.0 - 3.5.0 3.4.1 3.1.3 0.8.12 @@ -41,15 +45,17 @@ 3.10.1 3.5.0 2.4.0 + 1.7.0 3.21.2 3.7.0 0.16.1 + 0.6.1 3.3.1 4.0.0-M16 3.3.1 4.8.6.4 - 3.5.0 + 3.5.1 3.4.0 3.9.9 2.17.1 @@ -77,7 +83,7 @@ org.junit junit-bom - 5.11.1 + ${junit.version} pom import @@ -87,7 +93,7 @@ jakarta.platform jakarta.jakartaee-api - ${jakartaee-api.version} + 10.0.0 provided @@ -106,6 +112,7 @@ org.junit.jupiter junit-jupiter + ${junit.version} test @@ -210,29 +217,6 @@ maven-deploy-plugin ${maven.deploy-plugin.version} - - org.apache.maven.plugins maven-install-plugin @@ -364,12 +348,6 @@ org.apache.maven.plugins maven-compiler-plugin - org.apache.maven.plugins maven-javadoc-plugin @@ -394,7 +372,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.7.0 + ${maven.nexus-staging-plugin.version} true ossrh @@ -406,7 +384,7 @@ org.hjug.refactorfirst.plugin refactor-first-maven-plugin - 0.6.0 + ${maven.refactor-first-plugin.version} true @@ -654,7 +632,6 @@ 2.3.232 runtime - @@ -751,7 +728,7 @@ - + cloud @@ -762,7 +739,7 @@ http://localhost:8080/rest/graph-traversal/shortest-path org.postgresql.ds.PGPoolingDataSource ${postgreSqlJdbcUrl} @@ -847,6 +824,7 @@ false + 3.11.0 UTF-8 UTF-8 org.hsqldb.jdbc.JDBCDriver @@ -881,7 +859,7 @@ io.openliberty.tools liberty-maven-plugin - 3.10.3 + ${maven.liberty-plugin.version}