Skip to content

Commit ef88e02

Browse files
authored
[MINOR] Persist the Maven build cache between CI runs (#882)
* [MINOR] Persist the Maven build cache between CI runs .mvn/extensions.xml enables maven-build-cache-extension, but the cache never survives a CI run: actions/setup-java's `cache: maven` persists ~/.m2/repository only, while the extension writes to ~/.m2/build-cache. The effect is visible in any recent build log - ten modules, ten "Local build was not found by checksum" lines, zero restores - so every run rebuilds and retests all ten modules from scratch, including for pull requests that touch only the website or a single module. Restore ~/.m2/build-cache before the build and save it afterwards. Only main writes an entry; pull requests restore from main's rather than each branch consuming the repository-wide 10 GB cache budget. Source Build Check is deliberately left alone - it passes -Dmaven.build.cache.enabled=false and skips `cache: maven` on purpose, to prove the source release builds without prebuilt artifacts. * Keep the bundled jars out of the persisted build cache Persisting ~/.m2/build-cache as the previous commit does is only useful if the entry is small enough to live alongside the ~/.m2/repository caches in the repository-wide 10 GB budget. Measured, it is not: one generation is 1.2 GB, and 1.17 GB of that is three bundled jars - xtable-utilities (1.0 GB), xtable-hive-metastore (125 MB) and xtable-aws (42 MB). Those three modules are worth about 3 minutes of a 27 minute build. xtable-core and xtable-service are 84% of the time and about 1 MB of cache between them. Caching is worth it in inverse proportion to artifact size here, so opt the bundle producers out with the extension's per-project property, which disables both restore and save for that module. A cold build then writes 12 MB instead of 1.2 GB while still caching everything expensive; measured locally, a fully warm run restores 7 of 7 remaining modules. Also in this commit: - Add .mvn/maven-build-cache-config.xml pinning maxBuildsCached to 1, disabling the remote cache explicitly, and reconciling the surefire skip flags. Command line flags are not part of a module's checksum, so without reconciliation a build that skipped tests and one that ran them are indistinguishable to the cache. The flags are tracked without a skipValue attribute deliberately: skipValue relaxes the comparison rather than tightening it. - Bump maven-build-cache-extension 1.1.0 -> 1.2.3. Two invalidation fixes land in 1.2.1: MBUILDCACHE-87, plugin dependencies missing from the checksum, and MBUILDCACHE-99, moved files not always detected. Both affect whether a restore is correct, so they matter more once the cache actually persists. - Guard the save step on the cache directory staying under 100 MB, and warn when it does not, so a future module that starts caching large artifacts is visible rather than silently churning the budget. - Pass -Dmaven.build.cache.enabled=false when publishing a release. versions:set rewrites the version immediately beforehand, while cache restoration is version-agnostic. That runner keeps no cache directory today, so this is a guard against it gaining one, and it matches what source-build-check.yml already does deliberately. - Add the JDK to the Actions cache key, since the extension does not hash the JDK, and raise the job timeout from 30 to 40 minutes - a cold build is already 27 minutes against it, independent of caching. - Teach the spotless license-header delimiter about <cache, the root element of the new config file, alongside the <extensions entry that is already there for .mvn/extensions.xml. * Drop this project's own artifacts before the m2 repository cache is saved `mvn install` puts xtable's own artifacts into ~/.m2/repository, and that includes the bundled jars - about 1.2 GB, of which xtable-utilities alone is roughly 1 GB. actions/setup-java caches that directory wholesale and offers no way to exclude a path, so remove them in a final step, which runs before its post-save hook. They are rebuilt from source on every run, so they can never produce a useful cache hit, and a stale SNAPSHOT sitting in the local repository can shadow a reactor build. This is a guard rather than a fix. License Check currently reserves the shared cache key first - it downloads the whole dependency tree to inspect each jar's license, which is the useful half - and because it only runs `package`, the saved entry has never contained this project's artifacts. That is why this job logs "Unable to reserve cache with key" at the end of every run. The arrangement is the one we want, but it holds by ordering rather than by construction: if License Check ever fails or is cancelled before its post step, this job would win the key and save roughly 2.15 GB into a repository-wide 10 GB budget. * Manage the Maven repository cache explicitly, with one writer Both jobs used setup-java's `cache: maven`, which has two problems here. It restores on an exact key match only. setup-java sets no restore-keys deliberately, "to start with a clear cache after dependency update" (actions/setup-java#269), so any change to a pom or to extensions.xml made every job re-download the entire dependency tree from Central. Keying the same way but adding a prefix fallback warms from the previous entry and downloads only the delta. This commit changes both files, so it pays that cost once itself. It also gave the two jobs the same key, and cache entries are immutable, so whichever finished first reserved it and the other's save failed. License Check finishes in about two minutes and the full build takes 27, so in practice License Check always won and Maven CI Build logged "Unable to reserve cache with key" on every run. That outcome was the right one, which is why this makes it explicit rather than trying to win the race. License Check has to resolve every dependency in order to inspect each jar's license, so it populates exactly what the other jobs need, and it stops at `package`, so its entry never contains this project's own artifacts. It is now the sole writer; Maven CI Build restores the same key read-only and no longer attempts a save. The wrapper distribution was cached separately by setup-java, keyed on the wrapper properties so it survives pom changes. That is reproduced here rather than lost. Both jobs also clear ~/.m2/repository/org/apache/xtable before the post-job save, as Source Build Check already does. On the writer that guards the invariant above; on the reader it is belt and braces. * Write the Maven repository cache only from main The entry measures 981 MB against a repository-wide 10 GB budget, so a handful of concurrent pull requests with differing pom hashes would crowd out the entry they all restore from. Split restore and save so only main writes, matching what this branch already does for the build cache. Pull requests warm from main through the prefix fallback and re-download only their own delta. Saving is also conditional on the exact key having missed. Cache entries are immutable, so writing over an existing key just fails; that check is what actions/cache performs internally when restore and save are not split. The wrapper cache is left unsplit. At ~9 MB it is not worth gating, and it is keyed on the wrapper properties, which rarely change. * Reconcile the flags that skip tests without changing the checksum Failsafe is bound in the parent POM to integration-test and verify, and CI runs `install`, so integration tests run on every build and a restored module skips them exactly as it skips unit tests. Reconciles are matched per goal, and the two goals expose different parameters: testFailureIgnore is on verify only, and naming a parameter a goal does not have earns a warning on every build. The compiler entry closes a hole the surefire block does not reach. -Dmaven.test.skip=true never gets to surefire here, because the parent POM pins <skip>${skipUTs}</skip> and explicit plugin configuration wins over the user property, so surefire's skip parameter reads identically either way and the module checksum is byte-identical across the two. What the flag actually suppresses is test compilation. Verified on xtable-api, Temurin 11: seeding the cache with -Dmaven.test.skip=true and then running a plain `clean install` restored the untested build before this commit, and after it logs "Plugin parameter mismatch found. Parameter: skip, expected: true, actual: false" and runs the tests. A plain build still restores a plain build, and buildinfo.xml records all nine failsafe parameters as tracked="true" with no "Cannot find a Mojo parameter" warnings. * Derive the JDK in the cache keys from one place The JDK is in these keys because the build cache extension does not hash it, and the two workflows have to agree on the key or the reader stops finding what the writer saved. Four literal "jdk11" strings across two files could not express that; bumping actions/setup-java's java-version would have left them asserting a JDK that is no longer in use. * Resolve the whole reactor in the job that writes the repository cache "License Check has to resolve every dependency in order to inspect each jar's license" is not true, and the previous commit made it load- bearing. apache-rat:check declares no dependency resolution; dependency:tree collects poms rather than jars; and the shaded-bundle step names three modules and reaches only their -am closure. -am makes dependencies, not dependents, so the two leaves are outside it: nothing in the job resolves xtable-service's Quarkus stack, xtable-utilities' bundled dependencies, or maven-install-plugin, which only an `install` pulls. Maven CI Build is restore-only by construction, so it cannot fill that gap itself - it would re-download the delta from Central on every run, permanently. dependency:go-offline over the full reactor covers what the license steps do not. It runs only on main, where the save happens, and its failure must not fail a license check: an incomplete entry costs download time on the next run and nothing else. Verified: `./mvnw -B -ntp -q dependency:go-offline -Dmaven.build.cache.enabled=false` exits 0 across the reactor. * Bound the build cache save on both sides The save gated on `size_mb < 100` while the warning fired above 100, so a directory of exactly 100 MB - reachable, du -sm rounds up - was skipped silently, the one outcome the guard exists to make visible. It also treated the `${size_mb:-0}` fallback for a missing directory as a pass, handing actions/cache/save a path that is not there. Saving is now also conditional on the exact key having missed on restore. Cache entries are immutable, so a re-run of a main commit would try to write over its own entry and log "Unable to reserve cache with key" - the message the earlier commits removed by giving the two jobs separate keys. The repository cache save already carries this check.
1 parent 9b7883c commit ef88e02

9 files changed

Lines changed: 339 additions & 10 deletions

File tree

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

Lines changed: 110 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,125 @@ on:
2929
branches:
3030
- "main"
3131

32+
# The build cache extension does not hash the JDK, so it is part of every cache
33+
# key below. Defined once here rather than repeated, so that changing the JDK
34+
# cannot leave a key asserting the old one.
35+
env:
36+
JDK_VERSION: '11'
37+
3238
jobs:
3339
build:
3440
runs-on: ubuntu-latest
35-
timeout-minutes: 30
41+
# A cold build is ~27 min, which left no headroom under the previous 30.
42+
timeout-minutes: 40
3643
steps:
3744
- uses: actions/checkout@v7
3845

39-
- name: Set up JDK 11
46+
- name: Set up JDK ${{ env.JDK_VERSION }}
4047
uses: actions/setup-java@v5
4148
with:
42-
java-version: '11'
49+
java-version: ${{ env.JDK_VERSION }}
4350
distribution: 'temurin'
44-
cache: maven
51+
52+
# Restore only. License Check writes this cache, and only on `main`: it
53+
# finishes in a couple of minutes against this job's 27, and it stops at
54+
# `package` so the entry never carries this project's artifacts. It
55+
# resolves the reactor explicitly for this job's benefit; its own license
56+
# steps reach only part of it.
57+
# Previously both jobs used setup-java's `cache: maven`, which gave them
58+
# the same key, and whichever finished first reserved it - this job then
59+
# logged "Unable to reserve cache with key" on every single run. Making
60+
# the reader explicit removes the race rather than winning it.
61+
#
62+
# A warm start, not a guarantee: `install` here runs plugins that a build
63+
# stopping at `package` never resolves, so expect a delta every run.
64+
- name: Restore Maven repository cache
65+
uses: actions/cache/restore@v6
66+
with:
67+
path: ~/.m2/repository
68+
key: m2-repository-${{ runner.os }}-jdk${{ env.JDK_VERSION }}-${{ hashFiles('**/pom.xml', '**/.mvn/extensions.xml') }}
69+
restore-keys: |
70+
m2-repository-${{ runner.os }}-jdk${{ env.JDK_VERSION }}-
71+
72+
- name: Restore Maven wrapper cache
73+
uses: actions/cache/restore@v6
74+
with:
75+
path: ~/.m2/wrapper/dists
76+
key: m2-wrapper-${{ runner.os }}-${{ hashFiles('**/.mvn/wrapper/maven-wrapper.properties') }}
77+
78+
# A separate cache from the repository above: the build cache extension
79+
# configured in .mvn/extensions.xml writes to ~/.m2/build-cache, so
80+
# without this it starts empty every run and never restores a module.
81+
# Only `main` writes an entry, so pull requests warm up from `main` instead
82+
# of each branch filling the repository-wide cache budget.
83+
#
84+
# The modules producing large bundled jars opt out of the cache entirely
85+
# with <maven.build.cache.enabled>false</maven.build.cache.enabled> in their
86+
# own poms, which keeps this entry around 12 MB. Without that opt-out the
87+
# entry is 1.2 GB, 97% of it three shaded jars that account for only ~3 of
88+
# the 27 minutes a cold build takes.
89+
#
90+
# Note: a cache-restored xtable-service does not reproduce
91+
# target/quarkus-app. No step consumes that directory today; anything added
92+
# later that does must not rely on it being present.
93+
- name: Restore Maven build cache
94+
id: build-cache
95+
uses: actions/cache/restore@v6
96+
with:
97+
path: ~/.m2/build-cache
98+
key: maven-build-cache-${{ runner.os }}-jdk${{ env.JDK_VERSION }}-${{ github.sha }}
99+
restore-keys: |
100+
maven-build-cache-${{ runner.os }}-jdk${{ env.JDK_VERSION }}-
45101
46102
- name: Build all module with Maven
47103
run: ./mvnw clean install -ntp -B
104+
105+
# Guard against a module starting to cache large artifacts again: warn and
106+
# skip the save rather than churn the repository-wide 10 GB cache budget,
107+
# which is otherwise mostly the ~/.m2/repository entries above. Checking the
108+
# size rather than specific paths keeps this working across module renames.
109+
- name: Check Maven build cache size
110+
id: build-cache-size
111+
if: success() && github.ref == 'refs/heads/main'
112+
run: |
113+
size_mb=$(du -sm ~/.m2/build-cache 2>/dev/null | cut -f1)
114+
size_mb=${size_mb:-0}
115+
echo "size_mb=${size_mb}" >> "$GITHUB_OUTPUT"
116+
echo "~/.m2/build-cache is ${size_mb} MB"
117+
# The two bounds below are what the save step gates on, so they have to
118+
# cover the whole range between them: 0 means the extension wrote
119+
# nothing and there is no path for the save action to read.
120+
if [ "${size_mb}" -eq 0 ]; then
121+
echo "::warning title=Maven build cache not saved::~/.m2/build-cache is empty or absent. The build cache extension did not write anything; check that .mvn/extensions.xml is still in effect."
122+
elif [ "${size_mb}" -ge 100 ]; then
123+
echo "::warning title=Maven build cache not saved::~/.m2/build-cache is ${size_mb} MB (limit 100 MB). A module is caching large artifacts; opt it out with <maven.build.cache.enabled>false</maven.build.cache.enabled> in its pom."
124+
fi
125+
126+
# Skipped when the exact key already hit on restore - a re-run of the same
127+
# commit would otherwise try to write over an immutable entry and log the
128+
# "Unable to reserve cache with key" that splitting these jobs removed.
129+
- name: Save Maven build cache
130+
if: >
131+
success() && github.ref == 'refs/heads/main'
132+
&& steps.build-cache.outputs.cache-hit != 'true'
133+
&& steps.build-cache-size.outputs.size_mb > 0
134+
&& steps.build-cache-size.outputs.size_mb < 100
135+
uses: actions/cache/save@v6
136+
with:
137+
path: ~/.m2/build-cache
138+
key: maven-build-cache-${{ runner.os }}-jdk${{ env.JDK_VERSION }}-${{ github.sha }}
139+
140+
# `install` above puts this project's own artifacts into ~/.m2/repository,
141+
# including the bundled jars (~1.2 GB, xtable-utilities alone is ~1 GB).
142+
# actions/setup-java caches that whole directory with no way to exclude a
143+
# path, so drop them before its post step runs. They are rebuilt from
144+
# source on every run and can never produce a useful cache hit, and a
145+
# stale SNAPSHOT left in the local repository can shadow a reactor build.
146+
# Source Build Check clears the same path for the same reason.
147+
#
148+
# This job no longer saves that cache, so nothing depends on this today.
149+
# It is kept so the invariant holds by construction rather than by which
150+
# step happens to write last.
151+
- name: Drop this project's own artifacts from the Maven repository
152+
if: always()
153+
run: rm -rf ~/.m2/repository/org/apache/xtable

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

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,62 @@ on:
2929
branches:
3030
- "main"
3131

32+
# Kept in step with mvn-ci-build.yml: this job writes the cache that job reads,
33+
# and the JDK is part of the key on both sides.
34+
env:
35+
JDK_VERSION: '11'
36+
3237
jobs:
3338
build:
3439
runs-on: ubuntu-latest
3540
steps:
3641
- uses: actions/checkout@v7
3742

38-
- name: Set up JDK 11
43+
- name: Set up JDK ${{ env.JDK_VERSION }}
3944
uses: actions/setup-java@v5
4045
with:
41-
java-version: '11'
46+
java-version: ${{ env.JDK_VERSION }}
4247
distribution: 'temurin'
43-
cache: maven
48+
49+
# ~/.m2/repository is cached here rather than via setup-java's
50+
# `cache: maven`, which restores on an exact key match only - it sets no
51+
# restore-keys by design (actions/setup-java#269), so any pom change made
52+
# every job re-download the whole dependency tree from Central. The prefix
53+
# fallback below warms from the previous entry and downloads just the delta.
54+
#
55+
# This job is the writer for that cache, and deliberately the only one:
56+
# it is the short job, so making it the writer costs the least, and it
57+
# stops at `package`, so this project's own artifacts never enter the
58+
# entry. Maven CI Build restores the same key read-only.
59+
#
60+
# Being the only writer means this job has to resolve what the readers
61+
# need, which the license steps below do not do on their own - they build
62+
# the shaded modules and their `-am` closure, which excludes the two
63+
# leaves, xtable-utilities and xtable-service. The explicit resolve step
64+
# after them covers the rest of the reactor.
65+
#
66+
# Restore and save are split so that only `main` writes. The entry is
67+
# ~1 GB against a repository-wide 10 GB budget, so letting every branch
68+
# write one would crowd out the entry they all restore from. Pull requests
69+
# warm from `main` via the prefix and re-download only their own delta.
70+
- name: Restore Maven repository cache
71+
id: m2-repository
72+
uses: actions/cache/restore@v6
73+
with:
74+
path: ~/.m2/repository
75+
key: m2-repository-${{ runner.os }}-jdk${{ env.JDK_VERSION }}-${{ hashFiles('**/pom.xml', '**/.mvn/extensions.xml') }}
76+
restore-keys: |
77+
m2-repository-${{ runner.os }}-jdk${{ env.JDK_VERSION }}-
78+
79+
# Replaces the separate wrapper cache that setup-java's `cache: maven`
80+
# used to provide. Keyed only on the wrapper properties, which change
81+
# rarely, so it survives the pom changes that rotate the key above. Left
82+
# unsplit unlike the repository cache: at ~9 MB it is not worth gating.
83+
- name: Cache Maven wrapper
84+
uses: actions/cache@v6
85+
with:
86+
path: ~/.m2/wrapper/dists
87+
key: m2-wrapper-${{ runner.os }}-${{ hashFiles('**/.mvn/wrapper/maven-wrapper.properties') }}
4488

4589
- name: Apache License Check
4690
run: ./mvnw apache-rat:check -B
@@ -61,3 +105,42 @@ jobs:
61105
62106
- name: Validate Bundled License Texts
63107
run: python3 release/scripts/validate_bundled_license_texts.py
108+
109+
# Nothing above this line resolves xtable-utilities or xtable-service:
110+
# `apache-rat:check` requires no dependency resolution, `dependency:tree`
111+
# collects poms rather than jars, and the shaded-bundle build reaches only
112+
# the `-am` closure of the three modules it names, which excludes both
113+
# leaves. Without this step the entry never gains the Quarkus stack or
114+
# xtable-utilities' bundled dependencies, and Maven CI Build - which
115+
# cannot write the cache - would re-download them from Central on every
116+
# run, permanently. This job exists to warm the cache for that one, so it
117+
# has to cover the whole reactor even where a license check does not.
118+
#
119+
# Failure here must not fail a license check, hence `|| true`: an
120+
# incomplete cache entry costs download time on the next run and nothing
121+
# else. `go-offline` does not catch plugin dependencies resolved at
122+
# execution time, so expect a small delta regardless.
123+
- name: Resolve the rest of the reactor for the cache
124+
if: success() && github.ref == 'refs/heads/main'
125+
run: ./mvnw -B -ntp -q dependency:go-offline -Dmaven.build.cache.enabled=false || true
126+
127+
# This job writes the repository cache, so the invariant that the entry
128+
# holds third-party dependencies only is enforced here. The steps above
129+
# stop at `package`, so this is a no-op today; it exists so that adding
130+
# an `install` later cannot silently add ~1.2 GB of bundled jars to the
131+
# entry. Must stay ahead of the save below.
132+
- name: Drop this project's own artifacts from the Maven repository
133+
if: always()
134+
run: rm -rf ~/.m2/repository/org/apache/xtable
135+
136+
# Only when the exact key missed - entries are immutable, so saving over
137+
# an existing key just fails. This is what actions/cache does internally
138+
# when restore and save are not split.
139+
- name: Save Maven repository cache
140+
if: >
141+
success() && github.ref == 'refs/heads/main'
142+
&& steps.m2-repository.outputs.cache-hit != 'true'
143+
uses: actions/cache/save@v6
144+
with:
145+
path: ~/.m2/repository
146+
key: m2-repository-${{ runner.os }}-jdk${{ env.JDK_VERSION }}-${{ hashFiles('**/pom.xml', '**/.mvn/extensions.xml') }}

‎.github/workflows/package-deploy.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ jobs:
3535
- name: Set Version
3636
run: ./mvnw versions:set -DnewVersion="$VERSION"
3737
- name: Publish package
38-
run: ./mvnw -ntp --batch-mode deploy -DskipTests
38+
# Never build a release from cached module output. `versions:set` above has
39+
# just rewritten the version, while cache restoration is version-agnostic —
40+
# it stamps the current project version onto whatever it restores. This
41+
# runner keeps no build-cache directory today, so the flag is a guard
42+
# against that changing, and it also saves checksumming every module for a
43+
# cache that can never hit. Same reasoning as source-build-check.yml.
44+
run: ./mvnw -ntp --batch-mode deploy -DskipTests -Dmaven.build.cache.enabled=false
3945
env:
4046
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.mvn/extensions.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
<extension>
2121
<groupId>org.apache.maven.extensions</groupId>
2222
<artifactId>maven-build-cache-extension</artifactId>
23-
<version>1.1.0</version>
23+
<version>1.2.3</version>
2424
</extension>
2525
</extensions>

‎.mvn/maven-build-cache-config.xml‎

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to You under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
<cache xmlns="http://maven.apache.org/BUILD-CACHE-CONFIG/1.3.0"
19+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="http://maven.apache.org/BUILD-CACHE-CONFIG/1.3.0 https://maven.apache.org/xsd/build-cache-config-1.3.0.xsd">
21+
<configuration>
22+
<enabled>true</enabled>
23+
<remote enabled="false"/>
24+
<local>
25+
<!--
26+
One generation per module. The default of 3 accumulates generations,
27+
which matters because CI persists this directory between runs; a
28+
single generation keeps the saved entry at one build's size.
29+
-->
30+
<maxBuildsCached>1</maxBuildsCached>
31+
</local>
32+
</configuration>
33+
<executionControl>
34+
<reconcile>
35+
<plugins>
36+
<!--
37+
Command line flags are not part of a module's checksum, so without
38+
this a build that skipped tests and one that ran them are
39+
indistinguishable to the cache. Listing a property makes any
40+
difference between the cached build and the current run a cache
41+
miss, in both directions.
42+
43+
Deliberately no skipValue attribute: skipValue is a relaxation, not
44+
a guard. It tells the cache to tolerate a mismatch when the current
45+
run is the one skipping, which is exactly the exemption we do not
46+
want on a release build.
47+
-->
48+
<plugin artifactId="maven-surefire-plugin" goal="test">
49+
<reconciles>
50+
<reconcile propertyName="skip"/>
51+
<reconcile propertyName="skipExec"/>
52+
<reconcile propertyName="skipTests"/>
53+
<reconcile propertyName="testFailureIgnore"/>
54+
</reconciles>
55+
</plugin>
56+
<!--
57+
Failsafe is bound in the parent POM to integration-test and verify,
58+
and CI runs `install`, so integration tests run on every build and a
59+
restored module skips them exactly as it skips unit tests. -DskipITs
60+
is a command line flag, so the same gap applies. Reconciles are
61+
matched per goal, hence both entries; the parameter lists differ
62+
because testFailureIgnore exists on verify only, and naming a
63+
parameter a goal does not have earns a warning on every build.
64+
-->
65+
<plugin artifactId="maven-failsafe-plugin" goal="integration-test">
66+
<reconciles>
67+
<reconcile propertyName="skip"/>
68+
<reconcile propertyName="skipExec"/>
69+
<reconcile propertyName="skipITs"/>
70+
<reconcile propertyName="skipTests"/>
71+
</reconciles>
72+
</plugin>
73+
<plugin artifactId="maven-failsafe-plugin" goal="verify">
74+
<reconciles>
75+
<reconcile propertyName="skip"/>
76+
<reconcile propertyName="skipExec"/>
77+
<reconcile propertyName="skipITs"/>
78+
<reconcile propertyName="skipTests"/>
79+
<reconcile propertyName="testFailureIgnore"/>
80+
</reconciles>
81+
</plugin>
82+
<!--
83+
-Dmaven.test.skip=true never reaches surefire in this build: the
84+
parent POM pins <skip>${skipUTs}</skip>, and explicit plugin
85+
configuration wins over the user property, so surefire's skip
86+
parameter reads identically whether the flag is present or not.
87+
What the flag actually suppresses is test compilation. Without
88+
this entry the module checksum is byte-identical across the two,
89+
and a cache seeded by a `-Dmaven.test.skip=true` build restores
90+
into a plain `install` with the tests never having run.
91+
-->
92+
<plugin artifactId="maven-compiler-plugin" goal="testCompile">
93+
<reconciles>
94+
<reconcile propertyName="skip"/>
95+
</reconciles>
96+
</plugin>
97+
</plugins>
98+
</reconcile>
99+
</executionControl>
100+
</cache>

‎pom.xml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,8 @@
946946
</excludes>
947947
<licenseHeader>
948948
<file>style/xml-license-header</file>
949-
<delimiter>^&lt;project|^&lt;configuration|^&lt;Configuration|^&lt;extensions|^&lt;component</delimiter>
949+
<!-- ^&lt;cache is the root element of .mvn/maven-build-cache-config.xml -->
950+
<delimiter>^&lt;project|^&lt;configuration|^&lt;Configuration|^&lt;extensions|^&lt;component|^&lt;cache</delimiter>
950951
<skipLinesMatching>^&lt;.*xml.+?$</skipLinesMatching>
951952
</licenseHeader>
952953
</pom>

‎xtable-aws/pom.xml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@
2727

2828
<artifactId>xtable-aws</artifactId>
2929
<name>XTable AWS</name>
30+
<properties>
31+
<!--
32+
This module produces a large bundled jar (~42 MB). Keep it out of the
33+
maven-build-cache entirely: the property disables both restore and save
34+
for this project, so the artifact never enters the cache directory that
35+
CI persists between runs. Shading is cheap relative to the test suites
36+
the cache is there to skip, so there is nothing worth caching here.
37+
See .mvn/maven-build-cache-config.xml.
38+
-->
39+
<maven.build.cache.enabled>false</maven.build.cache.enabled>
40+
</properties>
3041

3142
<dependencies>
3243

0 commit comments

Comments
 (0)