-
Notifications
You must be signed in to change notification settings - Fork 208
[MINOR] Persist the Maven build cache between CI runs #882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a6e5233
e9bf7b4
fd12a7b
4972ec8
a289782
3414da6
16035f4
38ffe62
95dad45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| ~ Licensed to the Apache Software Foundation (ASF) under one or more | ||
| ~ contributor license agreements. See the NOTICE file distributed with | ||
| ~ this work for additional information regarding copyright ownership. | ||
| ~ The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| ~ (the "License"); you may not use this file except in compliance with | ||
| ~ the License. You may obtain a copy of the License at | ||
| ~ | ||
| ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| ~ | ||
| ~ Unless required by applicable law or agreed to in writing, software | ||
| ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| ~ See the License for the specific language governing permissions and | ||
| ~ limitations under the License. | ||
| --> | ||
| <cache xmlns="http://maven.apache.org/BUILD-CACHE-CONFIG/1.3.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/BUILD-CACHE-CONFIG/1.3.0 https://maven.apache.org/xsd/build-cache-config-1.3.0.xsd"> | ||
| <configuration> | ||
| <enabled>true</enabled> | ||
| <remote enabled="false"/> | ||
| <local> | ||
| <!-- | ||
| One generation per module. The default of 3 accumulates generations, | ||
| which matters because CI persists this directory between runs; a | ||
| single generation keeps the saved entry at one build's size. | ||
| --> | ||
| <maxBuildsCached>1</maxBuildsCached> | ||
| </local> | ||
| </configuration> | ||
| <executionControl> | ||
| <reconcile> | ||
| <plugins> | ||
| <!-- | ||
| Command line flags are not part of a module's checksum, so without | ||
| this a build that skipped tests and one that ran them are | ||
| indistinguishable to the cache. Listing a property makes any | ||
| difference between the cached build and the current run a cache | ||
| miss, in both directions. | ||
|
|
||
| Deliberately no skipValue attribute: skipValue is a relaxation, not | ||
| a guard. It tells the cache to tolerate a mismatch when the current | ||
| run is the one skipping, which is exactly the exemption we do not | ||
| want on a release build. | ||
| --> | ||
| <plugin artifactId="maven-surefire-plugin" goal="test"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need a similar config for the failsafe plugin?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes — and it turned out to matter more than the question implied. Two things came out of checking, both pushed in Failsafe itself. It is bound in the parent POM to The one that actually bites. Writing the failsafe entries made me test the surefire block properly instead of assuming it, and it does not cover On A plain Plain-to-plain still restores, so the guard costs nothing in CI. This is a local-developer hazard rather than a CI one today — CI writes the cache only from the plain
|
||
| <reconciles> | ||
| <reconcile propertyName="skip"/> | ||
| <reconcile propertyName="skipExec"/> | ||
| <reconcile propertyName="skipTests"/> | ||
| <reconcile propertyName="testFailureIgnore"/> | ||
| </reconciles> | ||
| </plugin> | ||
| <!-- | ||
| 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. -DskipITs | ||
| is a command line flag, so the same gap applies. Reconciles are | ||
| matched per goal, hence both entries; the parameter lists differ | ||
| because testFailureIgnore exists on verify only, and naming a | ||
| parameter a goal does not have earns a warning on every build. | ||
| --> | ||
| <plugin artifactId="maven-failsafe-plugin" goal="integration-test"> | ||
| <reconciles> | ||
| <reconcile propertyName="skip"/> | ||
| <reconcile propertyName="skipExec"/> | ||
| <reconcile propertyName="skipITs"/> | ||
| <reconcile propertyName="skipTests"/> | ||
| </reconciles> | ||
| </plugin> | ||
| <plugin artifactId="maven-failsafe-plugin" goal="verify"> | ||
| <reconciles> | ||
| <reconcile propertyName="skip"/> | ||
| <reconcile propertyName="skipExec"/> | ||
| <reconcile propertyName="skipITs"/> | ||
| <reconcile propertyName="skipTests"/> | ||
| <reconcile propertyName="testFailureIgnore"/> | ||
| </reconciles> | ||
| </plugin> | ||
| <!-- | ||
| -Dmaven.test.skip=true never reaches surefire in this build: the | ||
| parent POM pins <skip>${skipUTs}</skip>, and explicit plugin | ||
| configuration wins over the user property, so surefire's skip | ||
| parameter reads identically whether the flag is present or not. | ||
| What the flag actually suppresses is test compilation. Without | ||
| this entry the module checksum is byte-identical across the two, | ||
| and a cache seeded by a `-Dmaven.test.skip=true` build restores | ||
| into a plain `install` with the tests never having run. | ||
| --> | ||
| <plugin artifactId="maven-compiler-plugin" goal="testCompile"> | ||
| <reconciles> | ||
| <reconcile propertyName="skip"/> | ||
| </reconciles> | ||
| </plugin> | ||
| </plugins> | ||
| </reconcile> | ||
| </executionControl> | ||
| </cache> | ||
Uh oh!
There was an error while loading. Please reload this page.