Skip to content

Commit a27ef20

Browse files
committed
migrate to mvnw
1 parent 6ac30be commit a27ef20

File tree

70 files changed

+241
-353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+241
-353
lines changed

.github/workflows/website.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ jobs:
4242
restore-keys: |
4343
${{ runner.os }}-maven-
4444
- name: Build Hadoop maven plugins
45-
run: cd hadoop-maven-plugins && mvn --batch-mode install
45+
run: cd hadoop-maven-plugins && ../mvnw --batch-mode install
4646
- name: Build Hadoop
47-
run: mvn clean install -DskipTests -DskipShade
47+
run: ./mvnw clean install -DskipTests -DskipShade
4848
- name: Build document
49-
run: mvn clean site
49+
run: ./mvnw clean site
5050
- name: Stage document
51-
run: mvn site:stage -DstagingDirectory=${GITHUB_WORKSPACE}/staging/
51+
run: ./mvnw site:stage -DstagingDirectory=${GITHUB_WORKSPACE}/staging/
5252
- name: Deploy to GitHub Pages
5353
uses: peaceiris/actions-gh-pages@v3
5454
with:

.mvn/jvm.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-Xms256m
2+
-Xmx3072m

BUILDING.txt

Lines changed: 36 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Requirements:
55

66
* Unix System
77
* JDK 1.8
8-
* Maven 3.3 or later
98
* Boost 1.86.0 (if compiling native code)
109
* Protocol Buffers 3.21.12 (if compiling native code)
1110
* CMake 3.19 or newer (if compiling native code)
@@ -62,8 +61,6 @@ Refer to dev-support/docker/Dockerfile):
6261
* Open JDK 1.8
6362
$ sudo apt-get update
6463
$ sudo apt-get -y install openjdk-8-jdk
65-
* Maven
66-
$ sudo apt-get -y install maven
6764
* Native libraries
6865
$ sudo apt-get -y install build-essential autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev libsasl2-dev
6966
* GCC 9.3.0
@@ -139,19 +136,19 @@ Where to run Maven from?
139136
----------------------------------------------------------------------------------
140137
Maven build goals:
141138

142-
* Clean : mvn clean [-Preleasedocs]
143-
* Compile : mvn compile [-Pnative]
144-
* Run tests : mvn test [-Pnative] [-Pshelltest]
145-
* Create JAR : mvn package
146-
* Run spotbugs : mvn compile spotbugs:spotbugs
147-
* Run checkstyle : mvn compile checkstyle:checkstyle
148-
* Install JAR in M2 cache : mvn install
149-
* Deploy JAR to Maven repo : mvn deploy
150-
* Run clover : mvn test -Pclover
151-
* Run Rat : mvn apache-rat:check
152-
* Build javadocs : mvn javadoc:javadoc
153-
* Build distribution : mvn package [-Pdist][-Pdocs][-Psrc][-Pnative][-Dtar][-Preleasedocs][-Pyarn-ui]
154-
* Change Hadoop version : mvn versions:set -DnewVersion=NEWVERSION
139+
* Clean : ./mvnw clean [-Preleasedocs]
140+
* Compile : ./mvnw compile [-Pnative]
141+
* Run tests : ./mvnw test [-Pnative] [-Pshelltest]
142+
* Create JAR : ./mvnw package
143+
* Run spotbugs : ./mvnw compile spotbugs:spotbugs
144+
* Run checkstyle : ./mvnw compile checkstyle:checkstyle
145+
* Install JAR in M2 cache : ./mvnw install
146+
* Deploy JAR to Maven repo : ./mvnw deploy
147+
* Run clover : ./mvnw test -Pclover
148+
* Run Rat : ./mvnw apache-rat:check
149+
* Build javadocs : ./mvnw javadoc:javadoc
150+
* Build distribution : ./mvnw package [-Pdist][-Pdocs][-Psrc][-Pnative][-Dtar][-Preleasedocs][-Pyarn-ui]
151+
* Change Hadoop version : ./mvnw versions:set -DnewVersion=NEWVERSION
155152

156153
Build options:
157154

@@ -244,10 +241,10 @@ Maven build goals:
244241
* -Dtest=<TESTCLASSNAME>,<TESTCLASSNAME#METHODNAME>,....
245242
* -Dtest.exclude=<TESTCLASSNAME>
246243
* -Dtest.exclude.pattern=**/<TESTCLASSNAME1>.java,**/<TESTCLASSNAME2>.java
247-
* To run all native unit tests, use: mvn test -Pnative -Dtest=allNative
248-
* To run a specific native unit test, use: mvn test -Pnative -Dtest=<test>
244+
* To run all native unit tests, use: ./mvnw test -Pnative -Dtest=allNative
245+
* To run a specific native unit test, use: ./mvnw test -Pnative -Dtest=<test>
249246
For example, to run test_bulk_crc32, you would use:
250-
mvn test -Pnative -Dtest=test_bulk_crc32
247+
./mvnw test -Pnative -Dtest=test_bulk_crc32
251248

252249
Intel ISA-L build options:
253250

@@ -279,7 +276,7 @@ Maven build goals:
279276
OWASP's dependency-check plugin will scan the third party dependencies
280277
of this project for known CVEs (security vulnerabilities against them).
281278
It will produce a report in target/dependency-check-report.html. To
282-
invoke, run 'mvn dependency-check:aggregate'.
279+
invoke, run './mvnw dependency-check:aggregate'.
283280

284281
PMDK library build options:
285282

@@ -348,7 +345,7 @@ If you are building a submodule directory, all the hadoop dependencies this
348345
submodule has will be resolved as all other 3rd party dependencies. This is,
349346
from the Maven cache or from a Maven repository (if not available in the cache
350347
or the SNAPSHOT 'timed out').
351-
An alternative is to run 'mvn install -DskipTests' from Hadoop source top
348+
An alternative is to run './mvnw install -DskipTests' from Hadoop source top
352349
level once; and then work from the submodule. Keep in mind that SNAPSHOTs
353350
time out after a while, using the Maven '-nsu' will stop Maven from trying
354351
to update SNAPSHOTs from external repos.
@@ -358,7 +355,7 @@ Importing projects to eclipse
358355

359356
At first, install artifacts including hadoop-maven-plugins at the top of the source tree.
360357

361-
$ mvn clean install -DskipTests -DskipShade
358+
$ ./mvnw clean install -DskipTests -DskipShade
362359

363360
Then, import to eclipse by specifying the root directory of the project via
364361
[File] > [Import] > [Maven] > [Existing Maven Projects].
@@ -368,23 +365,23 @@ Building distributions:
368365

369366
Create binary distribution without native code and without Javadocs:
370367

371-
$ mvn package -Pdist -DskipTests -Dtar -Dmaven.javadoc.skip=true
368+
$ ./mvnw package -Pdist -DskipTests -Dtar -Dmaven.javadoc.skip=true
372369

373370
Create binary distribution with native code:
374371

375-
$ mvn package -Pdist,native -DskipTests -Dtar
372+
$ ./mvnw package -Pdist,native -DskipTests -Dtar
376373

377374
Create source distribution:
378375

379-
$ mvn package -Psrc -DskipTests
376+
$ ./mvnw package -Psrc -DskipTests
380377

381378
Create source and binary distributions with native code:
382379

383-
$ mvn package -Pdist,native,src -DskipTests -Dtar
380+
$ ./mvnw package -Pdist,native,src -DskipTests -Dtar
384381

385382
Create a local staging version of the website (in /tmp/hadoop-site)
386383

387-
$ mvn site site:stage -Preleasedocs,docs -DstagingDirectory=/tmp/hadoop-site
384+
$ ./mvnw site site:stage -Preleasedocs,docs -DstagingDirectory=/tmp/hadoop-site
388385

389386
Note that the site needs to be built in a second pass after other artifacts.
390387

@@ -406,13 +403,7 @@ Handling out of memory errors in builds
406403
----------------------------------------------------------------------------------
407404

408405
If the build process fails with an out of memory error, you should be able to fix
409-
it by increasing the memory used by maven which can be done via the environment
410-
variable MAVEN_OPTS.
411-
412-
Here is an example setting to allocate between 256 MB and 1.5 GB of heap space to
413-
Maven
414-
415-
export MAVEN_OPTS="-Xms256m -Xmx1536m"
406+
it by increasing the memory used by maven which can be done by modifying .mvn/jvm.config.
416407

417408
----------------------------------------------------------------------------------
418409

@@ -424,12 +415,11 @@ Installing required dependencies for clean install of macOS 10.14:
424415
* Install Xcode Command Line Tools
425416
$ xcode-select --install
426417
* Install Homebrew
427-
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
418+
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
428419
* Install OpenJDK 8
429-
$ brew tap AdoptOpenJDK/openjdk
430-
$ brew cask install adoptopenjdk8
431-
* Install maven and tools
432-
$ brew install maven autoconf automake cmake wget
420+
$ brew install openjdk@8
421+
* Install toolchains
422+
$ brew install autoconf automake cmake wget
433423
* Install native libraries, only openssl is required to compile native code,
434424
you may optionally install zlib, lz4, etc.
435425
$ brew install openssl
@@ -451,7 +441,7 @@ you need to backport both YARN-8622 and YARN-9487 in order to build native code.
451441
Building command example:
452442

453443
* Create binary distribution with native code but without documentation:
454-
$ mvn package -Pdist,native -DskipTests -Dmaven.javadoc.skip \
444+
$ ./mvnw package -Pdist,native -DskipTests -Dmaven.javadoc.skip \
455445
-Dopenssl.prefix=/usr/local/opt/openssl
456446

457447
Note that the command above manually specified the openssl library and include
@@ -465,9 +455,9 @@ Building on CentOS 8
465455
----------------------------------------------------------------------------------
466456

467457

468-
* Install development tools such as GCC, autotools, OpenJDK and Maven.
458+
* Install development tools such as GCC, autotools, OpenJDK.
469459
$ sudo dnf group install --with-optional 'Development Tools'
470-
$ sudo dnf install java-1.8.0-openjdk-devel maven
460+
$ sudo dnf install java-1.8.0-openjdk-devel
471461

472462
* Install python2 for building documentation.
473463
$ sudo dnf install python2
@@ -528,7 +518,6 @@ Requirements:
528518

529519
* Windows 10
530520
* JDK 1.8
531-
* Maven 3.3 or later (maven.apache.org)
532521
* Boost 1.86.0 (boost.org)
533522
* Protocol Buffers 3.21.12 (https://github.com/protocolbuffers/protobuf/tags)
534523
* CMake 3.19 or newer (cmake.org)
@@ -538,7 +527,7 @@ Requirements:
538527
* Zlib (zlib.net, if building native code bindings for zlib)
539528
* Git (preferably, get this from https://git-scm.com/download/win since the package also contains
540529
Unix command-line tools that are needed during packaging).
541-
* Python (python.org, for generation of docs using 'mvn site')
530+
* Python (python.org, for generation of docs using 'mvnw.cmd site')
542531
* Internet connection for first build (to fetch all Maven and Hadoop dependencies)
543532

544533
----------------------------------------------------------------------------------
@@ -610,7 +599,6 @@ OpenSSL and Zlib dependencies. Run the following commands to setup these depende
610599
Set the following environment variables -
611600
(Assuming that vcpkg was checked out at C:\vcpkg)
612601
> set PROTOBUF_HOME=C:\vcpkg\installed\x64-windows
613-
> set MAVEN_OPTS=-Xmx2048M -Xss128M
614602

615603
All Maven goals are the same as described above with the exception that
616604
native code is built by enabling the 'native-win' Maven profile. -Pnative-win
@@ -641,7 +629,7 @@ container. The Docker image does not have a full VS install, so you need to add
641629

642630
> set classpath=
643631
> set PROTOBUF_HOME=C:\vcpkg\installed\x64-windows
644-
> mvn clean package -Dhttps.protocols=TLSv1.2 -DskipTests -DskipDocs -Pnative-win,dist -Dskip.platformToolsetDetection^
632+
> mvnw.cmd clean package -Dhttps.protocols=TLSv1.2 -DskipTests -DskipDocs -Pnative-win,dist -Dskip.platformToolsetDetection^
645633
-Drequire.openssl -Drequire.test.libhadoop -Pyarn-ui -Dshell-executable=C:\Git\bin\bash.exe^
646634
-Dtar -Dopenssl.prefix=C:\vcpkg\installed\x64-windows^
647635
-Dcmake.prefix.path=C:\vcpkg\installed\x64-windows^
@@ -665,7 +653,7 @@ letter (like 'h') and rebuild -
665653
----------------------------------------------------------------------------------
666654
Building distributions:
667655

668-
* Build distribution with native code : mvn package [-Pdist][-Pdocs][-Psrc][-Dtar][-Dmaven.javadoc.skip=true]
656+
* Build distribution with native code : mvnw.cmd package [-Pdist][-Pdocs][-Psrc][-Dtar][-Dmaven.javadoc.skip=true]
669657

670658
----------------------------------------------------------------------------------
671659
Running compatibility checks with checkcompatibility.py
@@ -683,6 +671,6 @@ Changing the Hadoop version declared returned by VersionInfo
683671

684672
If for compatibility reasons the version of Hadoop has to be declared as a 2.x release in the information returned by
685673
org.apache.hadoop.util.VersionInfo, set the property declared.hadoop.version to the desired version.
686-
For example: mvn package -Pdist -Ddeclared.hadoop.version=2.11
674+
For example: mvnw.cmd package -Pdist -Ddeclared.hadoop.version=2.11
687675

688676
If unset, the project version declared in the POM file is used.

dev-support/bin/create-release

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,7 @@ function set_defaults
228228
LOGDIR="${BASEDIR}/patchprocess"
229229

230230
if [[ -z "${MVN}" ]]; then
231-
if [[ -n "${MAVEN_HOME}" ]]; then
232-
MVN=${MAVEN_HOME}/bin/mvn
233-
else
234-
MVN=$(command -v mvn)
235-
fi
231+
MVN="${BASEDIR}/mvnw"
236232
fi
237233

238234
NATIVE=false

dev-support/bin/verify-license-files

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ BASEDIR=$(hadoop_abs "${BINDIR}/../..")
124124

125125
pushd "${BASEDIR}" >/dev/null
126126
#shellcheck disable=SC2016
127-
PROJ_VERSION=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)
127+
PROJ_VERSION=$(${BASEDIR}/mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)
128128
popd >/dev/null
129129

130130
DIST_DIR="${BASEDIR}/hadoop-dist/target/hadoop-${PROJ_VERSION}"

dev-support/docker/Dockerfile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ ENV PYTHONIOENCODING=utf-8
6161
######
6262
# Set env vars required to build Hadoop
6363
######
64-
ENV MAVEN_HOME /usr
65-
# JAVA_HOME must be set in Maven >= 3.5.0 (MNG-6003)
6664
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
6765

6866
#######
@@ -76,11 +74,6 @@ ENV SPOTBUGS_HOME /opt/spotbugs
7674
ENV PROTOBUF_HOME /opt/protobuf
7775
ENV PATH "${PATH}:/opt/protobuf/bin"
7876

79-
###
80-
# Avoid out of memory errors in builds
81-
###
82-
ENV MAVEN_OPTS -Xms256m -Xmx3072m
83-
8477
# Skip gpg verification when downloading Yetus via yetus-wrapper
8578
ENV HADOOP_SKIP_YETUS_VERIFICATION true
8679

dev-support/docker/Dockerfile_aarch64

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ ENV PYTHONIOENCODING=utf-8
6262
######
6363
# Set env vars required to build Hadoop
6464
######
65-
ENV MAVEN_HOME /usr
66-
# JAVA_HOME must be set in Maven >= 3.5.0 (MNG-6003)
6765
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-arm64
6866

6967
#######
@@ -77,11 +75,6 @@ ENV SPOTBUGS_HOME /opt/spotbugs
7775
ENV PROTOBUF_HOME /opt/protobuf
7876
ENV PATH "${PATH}:/opt/protobuf/bin"
7977

80-
###
81-
# Avoid out of memory errors in builds
82-
###
83-
ENV MAVEN_OPTS -Xms256m -Xmx3072m
84-
8578
# Skip gpg verification when downloading Yetus via yetus-wrapper
8679
ENV HADOOP_SKIP_YETUS_VERIFICATION true
8780

dev-support/docker/Dockerfile_centos_7

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ ENV INFOPATH "${GCC_HOME}/root/usr/share/info"
7777
######
7878
# Set env vars required to build Hadoop
7979
######
80-
ENV MAVEN_HOME /opt/maven
81-
ENV PATH "${PATH}:${MAVEN_HOME}/bin"
82-
# JAVA_HOME must be set in Maven >= 3.5.0 (MNG-6003)
8380
ENV JAVA_HOME /usr/lib/jvm/java-1.8.0
8481

8582
#######
@@ -96,7 +93,6 @@ ENV PATH "${PATH}:/opt/protobuf/bin"
9693
######
9794
# Install packages
9895
######
99-
RUN pkg-resolver/install-maven.sh centos:7
10096
RUN pkg-resolver/install-cmake.sh centos:7
10197
RUN pkg-resolver/install-zstandard.sh centos:7
10298
RUN pkg-resolver/install-yasm.sh centos:7

dev-support/docker/Dockerfile_centos_8

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ ENV INFOPATH "${GCC_HOME}/root/usr/share/info"
9090
######
9191
# Set env vars required to build Hadoop
9292
######
93-
ENV MAVEN_HOME /opt/maven
94-
ENV PATH "${PATH}:${MAVEN_HOME}/bin"
95-
# JAVA_HOME must be set in Maven >= 3.5.0 (MNG-6003)
9693
ENV JAVA_HOME /usr/lib/jvm/java-1.8.0
9794

9895
#######
@@ -109,7 +106,6 @@ ENV PATH "${PATH}:/opt/protobuf/bin"
109106
######
110107
# Install packages
111108
######
112-
RUN pkg-resolver/install-maven.sh centos:8
113109
RUN pkg-resolver/install-cmake.sh centos:8
114110
RUN pkg-resolver/install-boost.sh centos:8
115111
RUN pkg-resolver/install-spotbugs.sh centos:8

dev-support/docker/Dockerfile_debian_10

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ RUN apt-get -q update \
5656
######
5757
# Set env vars required to build Hadoop
5858
######
59-
ENV MAVEN_HOME /usr
60-
# JAVA_HOME must be set in Maven >= 3.5.0 (MNG-6003)
6159
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64
6260

6361
#######
@@ -71,11 +69,6 @@ ENV SPOTBUGS_HOME /opt/spotbugs
7169
ENV PROTOBUF_HOME /opt/protobuf
7270
ENV PATH "${PATH}:/opt/protobuf/bin"
7371

74-
###
75-
# Avoid out of memory errors in builds
76-
###
77-
ENV MAVEN_OPTS -Xms256m -Xmx3072m
78-
7972
# Skip gpg verification when downloading Yetus via yetus-wrapper
8073
ENV HADOOP_SKIP_YETUS_VERIFICATION true
8174

0 commit comments

Comments
 (0)