Infrastructure worth keeping — and kept patched.

Enable or disable the Maven build cache extension: the switches that work

The Apache Maven Build Cache Extension has command-line switches to turn it off, skip the lookup, stop talking to the server, or stop uploading. Here is what each one did in a real run against a self-hosted cache (FosterStack Cache 0.2.1, Maven 3.10.0, extension 1.2.3).

The short answer

What we ran

A small Maven project with the extension set up as described in Maven remote build cache setup. Every build used a fresh copy of the project and an empty local build cache, so the only shared thing was the server. All seven builds ended with BUILD SUCCESS.

BuildAdded to the commandResult
1nothing (empty server)Compiled, and saved the result to the server
2nothing (another machine)Restored from the cache, no compile
3-Dmaven.build.cache.enabled=falseCompiled. The cache was off
4-Dmaven.build.cache.skipCache=trueCompiled, although a result was stored
5-Dmaven.build.cache.remote.enabled=falseCompiled. It did not ask the server at all
6-Dmaven.build.cache.remote.save.enabled=false (empty server)Compiled. The server still had 0 entries
7same as 6, againCompiled again, because nothing was ever stored

What Maven prints for each switch

enabled=false:
[INFO] Cache disabled by command line flag, project will be built fully and not cached

skipCache=true:
[INFO] Project demo:demo is marked as requiring force rebuild, will skip lookup in build cache

With remote.enabled=false there was no download attempt in the log. With remote.save.enabled=false the build still looked in the server, found nothing, and built locally.

"Error downloading cache item" on a normal miss

The first build against an empty server printed this line, and it still succeeded:

[ERROR] Error downloading cache item: http://127.0.0.1:18160//v1.1/demo/demo/ebb9bceba2f7a6bc/buildinfo.xml
[INFO] Remote cache is incomplete or missing, trying local build for demo:demo

In our run this was an ordinary miss: nothing was stored under that key yet, so Maven built the project itself. The next line says so. If you see this line on a cache that you know holds the result, check the address, the login and the proxy: see Maven build cache not restoring.

Which one to use

The same job for Gradle is on enable or disable the Gradle build cache.

Run on Maven 3.10.0 with maven-build-cache-extension 1.2.3 and FosterStack Cache 0.2.1, macOS (arm64).