Skip to content

Commit 50ae611

Browse files
[787] Add maven wrapper for consistent builds (#788)
* add a maven wrapper for consistent builds * update readme and docs to prefer mvnw for consistent builds * update more mvn usage * update deploy_staging_jars
1 parent f9ee948 commit 50ae611

15 files changed

Lines changed: 531 additions & 28 deletions

File tree

.github/workflows/mvn-ci-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ jobs:
4444
cache: maven
4545

4646
- name: Build all module with Maven
47-
run: mvn clean install -ntp -B
47+
run: ./mvnw clean install -ntp -B

.github/workflows/mvn-license-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ jobs:
4343
cache: maven
4444

4545
- name: Apache License Check
46-
run: mvn apache-rat:check -B
46+
run: ./mvnw apache-rat:check -B

.github/workflows/package-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
- name: Parse Version Number
3434
run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | sed -e s/v//)" >> $GITHUB_ENV
3535
- name: Set Version
36-
run: mvn versions:set -DnewVersion="$VERSION"
36+
run: ./mvnw versions:set -DnewVersion="$VERSION"
3737
- name: Publish package
38-
run: mvn -ntp --batch-mode deploy -DskipTests
38+
run: ./mvnw -ntp --batch-mode deploy -DskipTests
3939
env:
4040
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
wrapperVersion=3.3.4
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
# syntax=docker/dockerfile:1
1818

19-
FROM maven:3.9.8-eclipse-temurin-11-focal as package
19+
FROM eclipse-temurin:17-jdk-jammy as package
2020

2121
WORKDIR /build
2222

2323
COPY ./ ./
2424
RUN --mount=type=cache,target=/root/.m2 \
25-
MAVEN_OPTS=-Dorg.slf4j.simpleLogger.defaultLogLevel=warn mvn -B package -DskipTests
26-
RUN mv xtable-utilities/target/xtable-utilities_2.12-$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)-bundled.jar target/app.jar
25+
MAVEN_OPTS=-Dorg.slf4j.simpleLogger.defaultLogLevel=warn ./mvnw -B -am -pl xtable-utilities package -DskipTests
26+
RUN mv xtable-utilities/target/xtable-utilities_2.12-$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)-bundled.jar target/app.jar
2727

2828
FROM eclipse-temurin:17-jre-jammy AS final
2929

@@ -48,7 +48,7 @@ COPY --from=package build/target/app.jar ./app.jar
4848
ENTRYPOINT [ \
4949
"java", \
5050
"--add-opens=java.base/sun.nio.hb=ALL-UNNAMED", \
51-
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED", \
51+
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED", \
5252
"--add-opens=java.base/java.nio=ALL-UNNAMED", \
5353
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED", \
5454
"--add-opens=java.base/java.util=ALL-UNNAMED", \

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ future.
3333

3434
# Building the project and running tests.
3535
1. Use Java 11 for building the project. If you are using another Java version, you can use [jenv](https://github.com/jenv/jenv) to use multiple Java versions locally.
36-
2. Build the project using `mvn clean package`. Use `mvn clean package -DskipTests` to skip tests while building.
37-
3. Use `mvn clean test` or `mvn test` to run all unit tests. If you need to run only a specific test you can do this
38-
by something like `mvn test -Dtest=TestDeltaSync -pl xtable-core`.
39-
4. Similarly, use `mvn clean verify` or `mvn verify` to run integration tests.
36+
2. Build the project using `./mvnw clean package`. Use `./mvnw clean package -DskipTests` to skip tests while building.
37+
3. Use `./mvnw clean test` or `./mvnw test` to run all unit tests. If you need to run only a specific test you can do this
38+
by something like `./mvnw test -Dtest=TestDeltaSync -pl xtable-core`.
39+
4. Similarly, use `./mvnw clean verify` or `./mvnw verify` to run integration tests.
4040

4141
**Note:** When using Maven version 3.9 or above, Maven automatically caches the build. To ignore build caching, you can
42-
add the `-Dmaven.build.cache.enabled=false` parameter. For example, `mvn clean package -DskipTests -Dmaven.build.cache.enabled=false`
42+
add the `-Dmaven.build.cache.enabled=false` parameter. For example, `./mvnw clean package -DskipTests -Dmaven.build.cache.enabled=false`
4343

4444

4545
# Style guide
4646
1. We use [Maven Spotless plugin](https://github.com/diffplug/spotless/tree/main/plugin-maven) and
4747
[Google java format](https://github.com/google/google-java-format) for code style.
48-
2. Use `mvn spotless:check` to find out code style violations and `mvn spotless:apply` to fix them.
48+
2. Use `./mvnw spotless:check` to find out code style violations and `./mvnw spotless:apply` to fix them.
4949
Code style check is tied to compile phase by default, so code style violations will lead to build failures.
5050

5151
# Running the bundled jar
52-
1. Get a pre-built bundled jar or create the jar with `mvn install -DskipTests`
52+
1. Get a pre-built bundled jar or create the jar with `./mvnw install -DskipTests`
5353
2. Create a yaml file that follows the format below:
5454
```yaml
5555
sourceFormat: HUDI

demo/start_demo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CURRENT_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
2121
XTABLE_HOME="$( cd "$(dirname "$CURRENT_DIR")" ; pwd -P )"
2222
cd $XTABLE_HOME
2323

24-
mvn install -am -pl xtable-core -DskipTests -T 2
24+
./mvnw install -am -pl xtable-core -DskipTests -T 2
2525
mkdir -p demo/jars
2626
cp xtable-hudi-support/xtable-hudi-support-utils/target/xtable-hudi-support-utils-0.2.0-SNAPSHOT.jar demo/jars
2727
cp xtable-api/target/xtable-api-0.2.0-SNAPSHOT.jar demo/jars

0 commit comments

Comments
 (0)