Skip to content

Commit e3d8e58

Browse files
cowwocclaude
andcommitted
Add documentation for maven.build.cache.cacheCompile parameter
Document the new cacheCompile configuration parameter that controls whether compile-only builds create cache entries: - Add parameter to the command line flags table in parameters.md - Add how-to section explaining when to disable compile caching 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6fc92c8 commit e3d8e58

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/site/markdown/how-to.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,18 @@ Set attribute `excludeDependencies` to `true` in `input/plugins/plugin` section:
227227
</plugins>
228228
</input>
229229
```
230+
231+
### I want to disable caching of compile-only builds
232+
233+
By default, the cache extension saves build outputs when running compile-only phases (like `mvn compile` or `mvn test-compile`).
234+
This allows subsequent builds to restore compiled classes without recompilation. To disable this behavior and only cache
235+
builds that reach the package phase or later:
236+
237+
```shell
238+
mvn compile -Dmaven.build.cache.cacheCompile=false
239+
```
240+
241+
This is useful when:
242+
* You want to ensure cache entries always contain packaged artifacts (JARs, WARs, etc.)
243+
* Your workflow relies on artifacts being available in the local repository
244+
* You prefer the traditional behavior where only complete builds are cached

src/site/markdown/parameters.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ This document contains various configuration parameters supported by the cache e
3939
| `-Dmaven.build.cache.skipCache=(true/false)` | Skip looking up artifacts in caches. Does not affect writing artifacts to caches, disables only reading when set to `true` | May be used to trigger a forced rebuild when matching artifacts do exist in caches |
4040
| `-Dmaven.build.cache.skipSave=(true/false)` | Skip writing build result in caches. Does not affect reading from the cache. | Configuring MR builds to benefits from the cache, but restricting writes to the `master` branch |
4141
| `-Dmaven.build.cache.mandatoryClean=(true/false)` | Enable or disable the necessity to execute the `clean` phase in order to store the build result in cache | Reducing the risk to save "wrong" files in cache in a local dev environnement |
42+
| `-Dmaven.build.cache.cacheCompile=(true/false)` | Cache compile phase outputs (classes, test-classes, generated sources). When enabled (default), compile-only builds create cache entries that can be restored by subsequent builds. When disabled, caching only occurs during package phase or later. | Performance optimization for incremental builds |
4243

4344
### Project-level properties
4445

0 commit comments

Comments
 (0)