Skip to content

Commit 99ba4db

Browse files
committed
[FLINK-33501][ci] Makes use of Maven wrapper
1 parent 63996b5 commit 99ba4db

6 files changed

+11
-34
lines changed

.mvn/wrapper/maven-wrapper.properties

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17+
18+
# updating the Maven version requires updates to certain documentation and verification logic
1719
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
1820
distributionSha256Sum=ccf20a80e75a17ffc34d47c5c95c98c39d426ca17d670f09cd91e877072a9309
1921
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ trigger:
3636

3737
resources:
3838
containers:
39-
# Container with Maven 3.8.6, SSL to have the same environment everywhere.
39+
# Container with SSL to have the same environment everywhere.
4040
# see https://github.com/apache/flink-connector-shared-utils/tree/ci_utils
4141
- container: flink-build-container
4242
image: chesnay/flink-ci:java_8_11_17_21_maven_386

tools/azure-pipelines/build-apache-repo.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ trigger:
3636

3737
resources:
3838
containers:
39-
# Container with Maven 3.8.6, SSL to have the same environment everywhere.
39+
# Container with SSL to have the same environment everywhere.
4040
# see https://github.com/apache/flink-connector-shared-utils/tree/ci_utils
4141
- container: flink-build-container
4242
image: chesnay/flink-ci:java_8_11_17_21_maven_386

tools/azure-pipelines/build-nightly-dist.yml

-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ jobs:
4040
inputs:
4141
script: |
4242
source ./tools/ci/maven-utils.sh
43-
setup_maven
4443
run_mvn -version
4544
export MVN="run_mvn"
4645
@@ -93,7 +92,6 @@ jobs:
9392
inputs:
9493
script: |
9594
source ./tools/ci/maven-utils.sh
96-
setup_maven
9795
run_mvn -version
9896
9997
cd tools

tools/azure-pipelines/e2e-template.yml

-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ jobs:
9898
- script: |
9999
echo "Setting up Maven"
100100
source ./tools/ci/maven-utils.sh
101-
setup_maven
102101
103102
# the APT mirrors access is based on a proposal from https://github.com/actions/runner-images/issues/7048#issuecomment-1419426054
104103
echo "Configure APT mirrors"

tools/ci/maven-utils.sh

+7-29
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,13 @@
1616

1717
# Utility for invoking Maven in CI
1818
function run_mvn {
19-
MVN_CMD="mvn"
20-
if [[ "$M2_HOME" != "" ]]; then
21-
MVN_CMD="${M2_HOME}/bin/mvn"
22-
fi
23-
2419
if [[ "$MVN_RUN_VERBOSE" != "false" ]]; then
2520
echo "Invoking mvn with '$MVN_GLOBAL_OPTIONS ${@}'"
2621
fi
27-
$MVN_CMD $MVN_GLOBAL_OPTIONS "${@}"
22+
$MAVEN_WRAPPER $MVN_GLOBAL_OPTIONS "${@}"
2823
}
2924
export -f run_mvn
3025

31-
function setup_maven {
32-
set -e # fail if there was an error setting up maven
33-
if [ ! -d "${MAVEN_VERSIONED_DIR}" ]; then
34-
wget -nv https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/${MAVEN_VERSION}/apache-maven-${MAVEN_VERSION}-bin.zip
35-
unzip -d "${MAVEN_CACHE_DIR}" -qq "apache-maven-${MAVEN_VERSION}-bin.zip"
36-
rm "apache-maven-${MAVEN_VERSION}-bin.zip"
37-
fi
38-
39-
export M2_HOME="${MAVEN_VERSIONED_DIR}"
40-
echo "##vso[task.setvariable variable=M2_HOME]$M2_HOME"
41-
42-
# just in case: clean up the .m2 home and remove invalid jar files
43-
if [ -d "${HOME}/.m2/repository/" ]; then
44-
find ${HOME}/.m2/repository/ -name "*.jar" -exec sh -c 'if ! zip -T {} >/dev/null ; then echo "deleting invalid file: {}"; rm -f {} ; fi' \;
45-
fi
46-
47-
echo "Installed Maven ${MAVEN_VERSION} to ${M2_HOME}"
48-
set +e
49-
}
50-
5126
function set_mirror_config {
5227
if [[ "$MAVEN_MIRROR_CONFIG_FILE" != "" ]]; then
5328
echo "[WARN] Maven mirror already configured to $MAVEN_MIRROR_CONFIG_FILE"
@@ -81,10 +56,13 @@ function collect_coredumps {
8156

8257
CI_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
8358

84-
MAVEN_VERSION="3.8.6"
85-
MAVEN_CACHE_DIR=${HOME}/maven_cache
86-
MAVEN_VERSIONED_DIR=${MAVEN_CACHE_DIR}/apache-maven-${MAVEN_VERSION}
59+
if [[ ! "${CI_DIR}" =~ .*/tools/ci[/]{0,1}$ ]]; then
60+
echo "Error: ${BASH_SOURCE[0]} is expected to be located in the './tools/ci/' subfolder to make the Maven wrapper path resolution work."
61+
exit 1
62+
fi
63+
MAVEN_WRAPPER="${CI_DIR}/../../mvnw"
8764

65+
export MAVEN_WRAPPER
8866

8967
MAVEN_MIRROR_CONFIG_FILE=""
9068
NPM_PROXY_PROFILE_ACTIVATION=""

0 commit comments

Comments
 (0)