From ec9840fff23ddb8db11dfb367192fbe07c178723 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20Budiseli=C4=87?= <marko.budiselic@memgraph.com>
Date: Sat, 22 Jul 2023 12:29:36 +0200
Subject: [PATCH] Fix custom maven setup (#1044)

---
 environment/os/amzn-2.sh           | 10 +++++-----
 environment/os/centos-7.sh         | 10 +++++-----
 environment/os/centos-9.sh         | 10 +++++-----
 environment/os/debian-10.sh        | 10 +++++-----
 environment/os/debian-11-arm.sh    | 10 +++++-----
 environment/os/debian-11.sh        | 10 +++++-----
 environment/os/fedora-36.sh        | 10 +++++-----
 environment/os/ubuntu-18.04.sh     | 10 +++++-----
 environment/os/ubuntu-20.04.sh     | 10 +++++-----
 environment/os/ubuntu-22.04-arm.sh | 10 +++++-----
 environment/os/ubuntu-22.04.sh     | 10 +++++-----
 environment/util.sh                |  4 +++-
 12 files changed, 58 insertions(+), 56 deletions(-)

diff --git a/environment/os/amzn-2.sh b/environment/os/amzn-2.sh
index f2dcc4cc0..92e3ff3be 100755
--- a/environment/os/amzn-2.sh
+++ b/environment/os/amzn-2.sh
@@ -57,7 +57,7 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl-devel # mg-requests
     rpm-build rpmlint # for RPM package building
     doxygen graphviz # source documentation generators
-    which nodejs golang custom-golang1.18.9 zip unzip java-11-openjdk-devel jdk-17 custom-maven3.9.2 # for driver tests
+    which nodejs golang custom-golang1.18.9 zip unzip java-11-openjdk-devel jdk-17 custom-maven3.9.3 # for driver tests
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
     cyrus-sasl-devel
@@ -82,8 +82,8 @@ check() {
     local OLD_LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-""}
     LD_LIBRARY_PATH=""
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.3/bin/mvn" ]; then
               missing="$pkg $missing"
             fi
             continue
@@ -127,8 +127,8 @@ install() {
 
     yum update -y
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            install_custom_maven "3.9.2"
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            install_custom_maven "3.9.3"
             continue
         fi
         if [ "$pkg" == custom-golang1.18.9 ]; then
diff --git a/environment/os/centos-7.sh b/environment/os/centos-7.sh
index aa6cce77c..622dd4315 100755
--- a/environment/os/centos-7.sh
+++ b/environment/os/centos-7.sh
@@ -57,7 +57,7 @@ MEMGRAPH_BUILD_DEPS=(
     rpm-build rpmlint # for RPM package building
     doxygen graphviz # source documentation generators
     which mono-complete dotnet-sdk-3.1 golang custom-golang1.18.9 # for driver tests
-    nodejs zip unzip java-11-openjdk-devel jdk-17 custom-maven3.9.2 # for driver tests
+    nodejs zip unzip java-11-openjdk-devel jdk-17 custom-maven3.9.3 # for driver tests
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
     cyrus-sasl-devel
@@ -78,8 +78,8 @@ list() {
 check() {
     local missing=""
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.3/bin/mvn" ]; then
               missing="$pkg $missing"
             fi
             continue
@@ -134,8 +134,8 @@ install() {
     yum install -y git
 
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            install_custom_maven "3.9.2"
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            install_custom_maven "3.9.3"
             continue
         fi
         if [ "$pkg" == custom-golang1.18.9 ]; then
diff --git a/environment/os/centos-9.sh b/environment/os/centos-9.sh
index c1499f909..c20185d87 100755
--- a/environment/os/centos-9.sh
+++ b/environment/os/centos-9.sh
@@ -57,7 +57,7 @@ MEMGRAPH_BUILD_DEPS=(
     rpm-build rpmlint # for RPM package building
     doxygen graphviz # source documentation generators
     which nodejs golang custom-golang1.18.9 # for driver tests
-    zip unzip java-11-openjdk-devel java-17-openjdk java-17-openjdk-devel custom-maven3.9.2 # for driver tests
+    zip unzip java-11-openjdk-devel java-17-openjdk java-17-openjdk-devel custom-maven3.9.3 # for driver tests
     sbcl # for custom Lisp C++ preprocessing
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
@@ -79,8 +79,8 @@ list() {
 check() {
     local missing=""
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.3/bin/mvn" ]; then
               missing="$pkg $missing"
             fi
             continue
@@ -127,8 +127,8 @@ install() {
     yum install -y wget git python3 python3-pip
 
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            install_custom_maven "3.9.2"
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            install_custom_maven "3.9.3"
             continue
         fi
         if [ "$pkg" == custom-golang1.18.9 ]; then
diff --git a/environment/os/debian-10.sh b/environment/os/debian-10.sh
index 9318ac5df..cfd2849f8 100755
--- a/environment/os/debian-10.sh
+++ b/environment/os/debian-10.sh
@@ -53,7 +53,7 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # for custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs zip unzip default-jdk-headless oracle-java17-installer custom-maven3.9.2 # for driver tests
+    mono-runtime mono-mcs zip unzip default-jdk-headless oracle-java17-installer custom-maven3.9.3 # for driver tests
     dotnet-sdk-3.1 golang custom-golang1.18.9 nodejs npm # for driver tests
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
@@ -75,8 +75,8 @@ list() {
 check() {
     local missing=""
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.3/bin/mvn" ]; then
               missing="$pkg $missing"
             fi
             continue
@@ -124,8 +124,8 @@ EOF
     fi
 
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            install_custom_maven "3.9.2"
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            install_custom_maven "3.9.3"
             continue
         fi
         if [ "$pkg" == custom-golang1.18.9 ]; then
diff --git a/environment/os/debian-11-arm.sh b/environment/os/debian-11-arm.sh
index 1f50127d9..bc973a08f 100755
--- a/environment/os/debian-11-arm.sh
+++ b/environment/os/debian-11-arm.sh
@@ -54,7 +54,7 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # for custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk custom-maven3.9.2 # for driver tests
+    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk custom-maven3.9.3 # for driver tests
     golang custom-golang1.18.9 nodejs npm
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
@@ -76,8 +76,8 @@ list() {
 check() {
     local missing=""
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.3/bin/mvn" ]; then
               missing="$pkg $missing"
             fi
             continue
@@ -121,8 +121,8 @@ EOF
     apt install -y wget
 
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            install_custom_maven "3.9.2"
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            install_custom_maven "3.9.3"
             continue
         fi
         if [ "$pkg" == custom-golang1.18.9 ]; then
diff --git a/environment/os/debian-11.sh b/environment/os/debian-11.sh
index 3bd9bde20..740432125 100755
--- a/environment/os/debian-11.sh
+++ b/environment/os/debian-11.sh
@@ -54,7 +54,7 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # for custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk custom-maven3.9.2 # for driver tests
+    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk custom-maven3.9.3 # for driver tests
     dotnet-sdk-3.1 golang custom-golang1.18.9 nodejs npm
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
@@ -76,8 +76,8 @@ list() {
 check() {
     local missing=""
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.3/bin/mvn" ]; then
               missing="$pkg $missing"
             fi
             continue
@@ -121,8 +121,8 @@ EOF
     apt install -y wget
 
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            install_custom_maven "3.9.2"
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            install_custom_maven "3.9.3"
             continue
         fi
         if [ "$pkg" == custom-golang1.18.9 ]; then
diff --git a/environment/os/fedora-36.sh b/environment/os/fedora-36.sh
index ef7021afc..decd263b2 100755
--- a/environment/os/fedora-36.sh
+++ b/environment/os/fedora-36.sh
@@ -52,7 +52,7 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl-devel # mg-requests
     rpm-build rpmlint # for RPM package building
     doxygen graphviz # source documentation generators
-    java-11-openjdk-devel java-17-openjdk-devel custom-maven3.9.2 # for driver tests
+    java-11-openjdk-devel java-17-openjdk-devel custom-maven3.9.3 # for driver tests
     which zip unzip
     nodejs golang custom-golang1.18.9 # for driver tests
     sbcl # for custom Lisp C++ preprocessing
@@ -82,8 +82,8 @@ check() {
         LD_LIBRARY_PATH=""
     fi
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.3/bin/mvn" ]; then
               missing="$pkg $missing"
             fi
             continue
@@ -124,8 +124,8 @@ install() {
     dnf update -y
 
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            install_custom_maven "3.9.2"
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            install_custom_maven "3.9.3"
             continue
         fi
         if [ "$pkg" == custom-golang1.18.9 ]; then
diff --git a/environment/os/ubuntu-18.04.sh b/environment/os/ubuntu-18.04.sh
index e4b20ae1e..b599c0336 100755
--- a/environment/os/ubuntu-18.04.sh
+++ b/environment/os/ubuntu-18.04.sh
@@ -53,7 +53,7 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs nodejs zip unzip default-jdk-headless openjdk-17-jdk-headless custom-maven3.9.2 # driver tests
+    mono-runtime mono-mcs nodejs zip unzip default-jdk-headless openjdk-17-jdk-headless custom-maven3.9.3 # driver tests
     custom-golang1.18.9 # for driver tests
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
@@ -75,8 +75,8 @@ list() {
 check() {
     local missing=""
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.3/bin/mvn" ]; then
               missing="$pkg $missing"
             fi
             continue
@@ -101,8 +101,8 @@ install() {
     apt update -y
 
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            install_custom_maven "3.9.2"
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            install_custom_maven "3.9.3"
             continue
         fi
         if [ "$pkg" == custom-golang1.18.9 ]; then
diff --git a/environment/os/ubuntu-20.04.sh b/environment/os/ubuntu-20.04.sh
index 5b3fcfcf5..8a562c063 100755
--- a/environment/os/ubuntu-20.04.sh
+++ b/environment/os/ubuntu-20.04.sh
@@ -53,7 +53,7 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # for custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk-headless custom-maven3.9.2 # for driver tests
+    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk-headless custom-maven3.9.3 # for driver tests
     dotnet-sdk-3.1 golang custom-golang1.18.9 nodejs npm # for driver tests
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
@@ -75,8 +75,8 @@ list() {
 check() {
     local missing=""
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.3/bin/mvn" ]; then
               missing="$pkg $missing"
             fi
             continue
@@ -111,8 +111,8 @@ install() {
     fi
 
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            install_custom_maven "3.9.2"
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            install_custom_maven "3.9.3"
             continue
         fi
         if [ "$pkg" == custom-golang1.18.9 ]; then
diff --git a/environment/os/ubuntu-22.04-arm.sh b/environment/os/ubuntu-22.04-arm.sh
index 27039bfae..9a0af5a27 100755
--- a/environment/os/ubuntu-22.04-arm.sh
+++ b/environment/os/ubuntu-22.04-arm.sh
@@ -53,7 +53,7 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # for custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk-headless custom-maven3.9.2 # for driver tests
+    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk-headless custom-maven3.9.3 # for driver tests
     dotnet-sdk-6.0 golang custom-golang1.18.9 nodejs npm
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
@@ -75,8 +75,8 @@ list() {
 check() {
     local missing=""
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.3/bin/mvn" ]; then
               missing="$pkg $missing"
             fi
             continue
@@ -110,8 +110,8 @@ install() {
     apt install -y wget
 
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            install_custom_maven "3.9.2"
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            install_custom_maven "3.9.3"
             continue
         fi
         if [ "$pkg" == custom-golang1.18.9 ]; then
diff --git a/environment/os/ubuntu-22.04.sh b/environment/os/ubuntu-22.04.sh
index 02b659d1d..586dde744 100755
--- a/environment/os/ubuntu-22.04.sh
+++ b/environment/os/ubuntu-22.04.sh
@@ -53,7 +53,7 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # for custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk-headless custom-maven3.9.2 # for driver tests
+    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk-headless custom-maven3.9.3 # for driver tests
     dotnet-sdk-6.0 golang custom-golang1.18.9 nodejs npm # for driver tests
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
@@ -75,8 +75,8 @@ list() {
 check() {
     local missing=""
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.3/bin/mvn" ]; then
               missing="$pkg $missing"
             fi
             continue
@@ -110,8 +110,8 @@ install() {
     fi
 
     for pkg in $1; do
-        if [ "$pkg" == custom-maven3.9.2 ]; then
-            install_custom_maven "3.9.2"
+        if [ "$pkg" == custom-maven3.9.3 ]; then
+            install_custom_maven "3.9.3"
             continue
         fi
         if [ "$pkg" == custom-golang1.18.9 ]; then
diff --git a/environment/util.sh b/environment/util.sh
index c6c48cc68..be0952c42 100644
--- a/environment/util.sh
+++ b/environment/util.sh
@@ -93,8 +93,10 @@ function install_custom_golang() {
 function install_custom_maven() {
   MVNVERSION="$1"
   MVNINSTALLDIR="/opt/apache-maven-$MVNVERSION"
+  MVNURL="https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/maven/apache-maven-$MVNVERSION-bin.tar.gz"
   if [ ! -f "$MVNINSTALLDIR/bin/mvn" ]; then
-    curl -LO "https://dlcdn.apache.org/maven/maven-3/$MVNVERSION/binaries/apache-maven-$MVNVERSION-bin.tar.gz"
+    echo "Downloading maven from $MVNURL"
+    curl -LO "$MVNURL"
     tar -C "/opt" -xzf "apache-maven-$MVNVERSION-bin.tar.gz"
   fi
   echo "maven $MVNVERSION installed under $MVNINSTALLDIR"