Skip to content

Commit 2009e0e

Browse files
authored
NUTCH-3167 Upgrade to Hadoop 3.5.0 (#911)
1 parent 31c44b2 commit 2009e0e

19 files changed

Lines changed: 332 additions & 598 deletions

.github/workflows/junit-report.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,44 @@ concurrency:
2424
cancel-in-progress: true
2525

2626
permissions:
27+
actions: read
2728
checks: write
2829
contents: read
2930
issues: write
3031
pull-requests: write
3132
jobs:
3233
checks:
34+
if: github.event.workflow_run.conclusion == 'success'
3335
runs-on: ubuntu-latest
3436
steps:
35-
- name: Download Test Report (Ubuntu)
37+
- name: Set up JDK 17
38+
uses: actions/setup-java@v5
39+
with:
40+
java-version: '17'
41+
distribution: 'temurin'
42+
- name: Download Test Report (Ubuntu JDK 17)
3643
uses: dawidd6/action-download-artifact@v11
3744
with:
38-
name: junit-test-results-ubuntu-latest
45+
name: junit-test-results-ubuntu-latest-jdk17
3946
workflow: master-build.yml
4047
run_id: ${{ github.event.workflow_run.id }}
41-
continue-on-error: true
48+
path: ./junit-ubuntu-jdk17
49+
- name: Verify JUnit XML layout
50+
run: |
51+
set -euo pipefail
52+
shopt -s globstar nullglob
53+
root="./junit-ubuntu-jdk17"
54+
if [ ! -d "$root" ]; then
55+
echo "::error::Download path $root is missing."
56+
exit 1
57+
fi
58+
files=("$root"/build/**/TEST-*.xml)
59+
if [ ${#files[@]} -eq 0 ] || [ ! -e "${files[0]}" ]; then
60+
echo "::error::No TEST-*.xml under $root/build/ (artifact missing, wrong layout, or download failed)."
61+
find "$root" -maxdepth 5 -type d -print 2>/dev/null | head -80 || true
62+
exit 1
63+
fi
64+
echo "Found ${#files[@]} JUnit report file(s) under $root/build/."
4265
- name: Resolve PR number
4366
id: pr
4467
run: |
@@ -59,12 +82,8 @@ jobs:
5982
- name: Publish Test Report
6083
uses: mikepenz/action-junit-report@v6
6184
with:
62-
report_paths: |-
63-
./test/TEST-*.xml
64-
./*/**/test/TEST-*.xml
65-
check_name: |-
66-
JUnit Test Report
67-
JUnit Test Report Plugins
85+
report_paths: ./junit-ubuntu-jdk17/build/**/TEST-*.xml
86+
check_name: JUnit Test Report
6887
commit: ${{ github.event.workflow_run.head_sha }}
6988
fail_on_failure: false
7089
fail_on_parse_error: true

.github/workflows/master-build.yml

Lines changed: 36 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,15 @@ concurrency:
2626
cancel-in-progress: true
2727

2828
# Java Version Strategy:
29-
# - BUILD: Requires Java 17+ (JUnit 6 dependency)
30-
# - RUNTIME: Supports Java 11+ (javac.version=11 produces Java 11 bytecode)
31-
#
32-
# The 'build' job verifies bytecode compilation for both Java 11 and 17 targets.
33-
# The 'runtime-java11' job verifies the built artifacts actually run on Java 11.
34-
# The 'tests' job runs on JDK 17 (required by JUnit 6) with the default
35-
# javac.version=11 bytecode target for backward compatibility.
29+
# - Requires Java 17+ to build, test, and run (Hadoop 3.5+ client + JUnit 6).
30+
# - Default bytecode: javac.version=17 (see default.properties).
31+
# - CI exercises Eclipse Temurin JDK 17 and JDK 21 on Ubuntu (and tests on macOS).
3632

3733
jobs:
3834
javadoc:
3935
strategy:
4036
matrix:
41-
java: ['17']
37+
java: ['17', '21']
4238
os: [ubuntu-latest]
4339
runs-on: ${{ matrix.os }}
4440
steps:
@@ -61,7 +57,7 @@ jobs:
6157
rat:
6258
strategy:
6359
matrix:
64-
java: ['17']
60+
java: ['17', '21']
6561
os: [ubuntu-latest]
6662
runs-on: ${{ matrix.os }}
6763
steps:
@@ -112,22 +108,21 @@ jobs:
112108
if: steps.filter.outputs.openapi == 'true'
113109
run: ./node_modules/.bin/lint-openapi openapi.yaml
114110

115-
# Build verification with Java bytecode target matrix
116-
# Verifies bytecode compatibility for both Java 11 and Java 17 targets
111+
# Build verification on JDK 17 and 21 (bytecode target Java 17)
117112
build:
118113
strategy:
119114
fail-fast: false
120115
matrix:
121-
javac-version: ['11', '17']
116+
java: ['17', '21']
122117
os: [ubuntu-latest]
123118
runs-on: ${{ matrix.os }}
124-
name: build (javac.version=${{ matrix.javac-version }})
119+
name: build (jdk ${{ matrix.java }}, javac.version=17)
125120
steps:
126121
- uses: actions/checkout@v5
127-
- name: Set up JDK 17
122+
- name: Set up JDK ${{ matrix.java }}
128123
uses: actions/setup-java@v5
129124
with:
130-
java-version: '17'
125+
java-version: ${{ matrix.java }}
131126
distribution: 'temurin'
132127
- name: Cache Ivy dependencies
133128
uses: actions/cache@v4
@@ -136,14 +131,13 @@ jobs:
136131
key: ${{ runner.os }}-ivy-${{ hashFiles('ivy/ivy.xml', 'src/plugin/**/ivy.xml') }}
137132
restore-keys: |
138133
${{ runner.os }}-ivy-
139-
- name: Build with javac.version=${{ matrix.javac-version }}
140-
run: ant clean runtime -Djavac.version=${{ matrix.javac-version }} -buildfile build.xml
134+
- name: Build with javac.version=17
135+
run: ant clean runtime -Djavac.version=17 -buildfile build.xml
141136
- name: Verify bytecode version
142137
run: |
143-
# Extract and verify the bytecode version of compiled classes
144-
# Java 11 = major version 55, Java 17 = major version 61
145-
EXPECTED_VERSION=${{ matrix.javac-version == '11' && '55' || '61' }}
146-
echo "Expected major version: $EXPECTED_VERSION (Java ${{ matrix.javac-version }})"
138+
# Java 17 = major version 61
139+
EXPECTED_VERSION=61
140+
echo "Expected major version: $EXPECTED_VERSION (Java 17 bytecode)"
147141
148142
# Find a real class file (exclude package-info.class which may have different version)
149143
cd build/classes
@@ -162,17 +156,21 @@ jobs:
162156
exit 1
163157
fi
164158
165-
# Verify runtime compatibility on Java 11
166-
# This ensures the built artifacts can actually run on Java 11
167-
runtime-java11:
159+
# Smoke-test runtime on the same JDK used to build (17 and 21)
160+
runtime-smoke:
168161
needs: build
162+
strategy:
163+
fail-fast: false
164+
matrix:
165+
java: ['17', '21']
169166
runs-on: ubuntu-latest
167+
name: runtime-smoke (jdk ${{ matrix.java }})
170168
steps:
171169
- uses: actions/checkout@v5
172-
- name: Set up JDK 17 for building
170+
- name: Set up JDK ${{ matrix.java }}
173171
uses: actions/setup-java@v5
174172
with:
175-
java-version: '17'
173+
java-version: ${{ matrix.java }}
176174
distribution: 'temurin'
177175
- name: Cache Ivy dependencies
178176
uses: actions/cache@v4
@@ -181,38 +179,31 @@ jobs:
181179
key: ${{ runner.os }}-ivy-${{ hashFiles('ivy/ivy.xml', 'src/plugin/**/ivy.xml') }}
182180
restore-keys: |
183181
${{ runner.os }}-ivy-
184-
- name: Build with Java 11 target
185-
run: ant clean runtime -Djavac.version=11 -buildfile build.xml
186-
- name: Set up JDK 11 for runtime verification
187-
uses: actions/setup-java@v5
188-
with:
189-
java-version: '11'
190-
distribution: 'temurin'
191-
- name: Verify runtime on Java 11
182+
- name: Build with javac.version=17
183+
run: ant clean runtime -Djavac.version=17 -buildfile build.xml
184+
- name: Verify runtime on JDK ${{ matrix.java }}
192185
run: |
193-
echo "Verifying Nutch can run on Java 11..."
186+
echo "Verifying Nutch on JDK ${{ matrix.java }}..."
194187
java -version
195188
cd runtime/local
196-
# Actually load Java classes by running showproperties
197-
# This invokes org.apache.nutch.tools.ShowProperties and verifies the JAR loads
198189
bin/nutch showproperties | head -20
199-
echo "Java 11 runtime verification complete"
190+
echo "Runtime smoke test complete"
200191
201-
# Tests run on JDK 17 (required by JUnit 6) with default javac.version=11
202-
# Java 11 runtime compatibility is verified by the runtime-java11 job
203192
tests:
204193
strategy:
205194
fail-fast: false
206195
matrix:
196+
java: ['17', '21']
207197
os: [ubuntu-latest, macos-latest]
208198
runs-on: ${{ matrix.os }}
199+
name: tests (jdk ${{ matrix.java }}, ${{ matrix.os }})
209200
timeout-minutes: 45
210201
steps:
211202
- uses: actions/checkout@v5
212-
- name: Set up JDK 17
203+
- name: Set up JDK ${{ matrix.java }}
213204
uses: actions/setup-java@v5
214205
with:
215-
java-version: '17'
206+
java-version: ${{ matrix.java }}
216207
distribution: 'temurin'
217208
- name: Cache Ivy dependencies
218209
uses: actions/cache@v4
@@ -266,9 +257,9 @@ jobs:
266257
fi
267258
- name: Upload Test Report
268259
uses: actions/upload-artifact@v4
269-
if: always() && matrix.os == 'ubuntu-latest' && steps.check_tests.outputs.has_results == 'true'
260+
if: always() && matrix.os == 'ubuntu-latest' && matrix.java == '17' && steps.check_tests.outputs.has_results == 'true'
270261
with:
271-
name: junit-test-results-${{ matrix.os }}
262+
name: junit-test-results-${{ matrix.os }}-jdk${{ matrix.java }}
272263
path: |
273264
./build/test/TEST-*.xml
274265
./build/**/test/TEST-*.xml
@@ -277,7 +268,7 @@ jobs:
277268
uses: actions/upload-artifact@v4
278269
if: always() && matrix.os == 'ubuntu-latest'
279270
with:
280-
name: coverage-data
271+
name: coverage-data-ubuntu-jdk${{ matrix.java }}
281272
path: ./build/coverage/*.exec
282273
retention-days: 1
283274
if-no-files-found: ignore

.github/workflows/sonarcloud.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,27 @@ jobs:
5252
${{ runner.os }}-ivy-
5353
- name: Compile (no tests)
5454
run: ant compile compile-plugins resolve-test -buildfile build.xml
55-
- name: Download coverage data
55+
# Coverage and JUnit XML come only from the master-build Ubuntu JDK 17 matrix job.
56+
- name: Download coverage data (Ubuntu JDK 17)
5657
uses: dawidd6/action-download-artifact@v11
5758
with:
58-
name: coverage-data
59+
name: coverage-data-ubuntu-jdk17
5960
workflow: master-build.yml
6061
run_id: ${{ github.event.workflow_run.id }}
6162
path: ./build/coverage/
6263
continue-on-error: true
63-
- name: Download test reports
64+
- name: Download test reports (Ubuntu JDK 17)
6465
uses: dawidd6/action-download-artifact@v11
6566
with:
66-
name: junit-test-results-ubuntu-latest
67+
name: junit-test-results-ubuntu-latest-jdk17
6768
workflow: master-build.yml
6869
run_id: ${{ github.event.workflow_run.id }}
69-
path: ./build/test/
70+
path: ./build/test-jdk17/
7071
continue-on-error: true
71-
- name: Flatten test reports
72+
- name: Flatten test reports (JDK 17 only)
7273
run: |
7374
mkdir -p ./build/test-reports
74-
find ./build/test -name 'TEST-*.xml' -exec cp {} ./build/test-reports/ \;
75+
find ./build/test-jdk17 -name 'TEST-*.xml' -exec cp {} ./build/test-reports/ \; 2>/dev/null || true
7576
continue-on-error: true
7677
- name: Generate JaCoCo XML report
7778
run: ant jacoco-report -buildfile build.xml
@@ -110,7 +111,7 @@ jobs:
110111
GH_TOKEN: ${{ github.token }}
111112
- name: SonarCloud Scan (PR)
112113
if: steps.pr.outputs.is_pr == 'true'
113-
uses: SonarSource/sonarqube-scan-action@v6
114+
uses: SonarSource/sonarqube-scan-action@299e4b793aaa83bf2aba7c9c14bedbb485688ec4
114115
with:
115116
args: >
116117
-Dsonar.pullrequest.key=${{ steps.pr.outputs.number }}
@@ -121,7 +122,7 @@ jobs:
121122
SONAR_HOST_URL: https://sonarcloud.io
122123
- name: SonarCloud Scan (branch)
123124
if: steps.pr.outputs.is_pr == 'false' && steps.pr.outputs.skip != 'true'
124-
uses: SonarSource/sonarqube-scan-action@v6
125+
uses: SonarSource/sonarqube-scan-action@299e4b793aaa83bf2aba7c9c14bedbb485688ec4
125126
with:
126127
args: >
127128
-Dsonar.branch.name=${{ github.event.workflow_run.head_branch }}

.github/workflows/yetus.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
# Apache Yetus test-patch: pre-commit patch testing (Ant, JDK 17).
17-
# Runs alongside master-build.yml; all CI is unified on Java 17.
16+
# Apache Yetus test-patch: pre-commit patch testing (apache/yetus-test-patch-action).
17+
# The action runs inside ghcr.io/apache/yetus:0.15.1 — javahome must be a JDK path
18+
# inside that image (OpenJDK 11 on amd64), not actions/setup-java on the runner.
1819
# See https://yetus.apache.org/documentation/0.15.1/precommit/
1920
---
2021
name: Apache Yetus
@@ -43,7 +44,6 @@ jobs:
4344
timeout-minutes: 45
4445
env:
4546
PATCH_DIR: ${{ github.workspace }}/out
46-
JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64
4747
steps:
4848
- uses: actions/checkout@v5
4949
with:
@@ -61,7 +61,7 @@ jobs:
6161
basedir: .
6262
buildtool: nobuild
6363
githubtoken: ${{ secrets.GITHUB_TOKEN }}
64-
javahome: '/usr/lib/jvm/java-17-openjdk-amd64'
64+
javahome: /usr/lib/jvm/java-11-openjdk-amd64
6565
patchdir: /github/workspace/out
6666
plugins: all,-jira,-gitlab,-unit,-compile
6767
project: nutch

.yetus/blanks-tabs.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Ignore tabs in Yetus-generated patch dir (not source files).
2+
# See --blanks-tabs-ignore-file in the blanks plugin.
3+
^out/

.yetus/personality.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
# Ensure JAVA_HOME is set for pre-patch and other phases when running in
17-
# the Yetus Docker container (avoids "JAVA_HOME is not defined" in pre-patch).
18-
if [ -z "${JAVA_HOME}" ] && [ -d "/usr/lib/jvm/java-17-openjdk-amd64" ]; then
19-
export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
16+
# Ensure JAVA_HOME is set for pre-patch and other phases. The Yetus GitHub Action
17+
# runs inside ghcr.io/apache/yetus (see yetus.yml javahome). This fallback matches
18+
# OpenJDK layouts on Debian/Ubuntu when JAVA_HOME is not already set.
19+
if [ -z "${JAVA_HOME}" ] && [ -d "/usr/lib/jvm/java-11-openjdk-amd64" ]; then
20+
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
21+
elif [ -z "${JAVA_HOME}" ] && [ -d "/usr/lib/jvm/java-11-openjdk-arm64" ]; then
22+
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-arm64"
2023
fi
2124

2225
# Pass JAVA_HOME into the re-exec Docker container so pre-patch and other

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ radio button and select "Eclipse". Click "Create". On the next screen the
105105
"Eclipse projects directory" should be already set to the nutch folder. Leave
106106
the "Create module files near .classpath files" radio button selected.
107107

108-
Click "Next" on the next screens. On the project SDK screen select Java 11 and
109-
click "Create". **N.B.** On Mac with homebrew openjdk, use the directory under
110-
_libexec_: `<openjdk11_directory>/libexec/openjdk.jdk/Contents/Home`.
108+
Click "Next" on the next screens. On the project SDK screen select Java 17
109+
(or newer) and click "Create". **N.B.** On Mac with homebrew openjdk, use the
110+
directory under _libexec_: `<openjdk_directory>/libexec/openjdk.jdk/Contents/Home`.
111111

112112
Once the project is imported, you will see a popup saying "Ant build scripts
113113
found", "Frameworks detected - IvyIDEA Framework detected". Click "Import". If

build.xml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,12 @@
5656
<property name="ant-eclipse.jar" value="${ivy.dir}/lib/ant-eclipse-1.0-jvm1.2.jar" />
5757

5858
<!--
59-
Java Version Strategy (see HADOOP-18887 for similar approach):
59+
Java Version Strategy:
6060
61-
BUILD REQUIREMENT: Java 17+ is required to build Nutch and run unit tests
62-
because JUnit 6 (Jupiter) requires Java 17+.
63-
64-
RUNTIME COMPATIBILITY: The compiled bytecode targets Java 11 by default
65-
(javac.version=11 in default.properties), allowing the binary package
66-
to run on Java 11+ environments. This is important for Hadoop clusters
67-
that may not yet support Java 17 runtime.
68-
69-
To build with Java 17 bytecode target: ant -Djavac.version=17 ...
61+
Java 17+ is required to build, run unit tests, and run Nutch with the
62+
Ivy-resolved Hadoop 3.5+ client libraries (Java 17 bytecode).
63+
Default bytecode level is javac.version=17 in default.properties.
64+
Use an older Nutch release line if you must run on Java 11.
7065
-->
7166

7267
<!-- the normal classpath -->

0 commit comments

Comments
 (0)