To on-board incremental Maven you need to complete several steps:
pom.xml
or .mvn/extensions.xml
)maven-cache-config.xml
cache config in .mvn/
(optional) to customize default behavior<extension> <groupId>org.apache.maven.extensions</groupId> <artifactId>maven-build-cache-extension</artifactId> <version>1.0.0-SNAPSHOT</version> </extension>
either in pom.xml
's <project>/<build>/<extensions>
or in .mvn/extensions.xml
's <extensions>
Copy default config maven-cache-config.xml
to .mvn/
directory of your project.
To get overall understanding of cache machinery, it is recommended to review the config and read comments. In typical scenario you need to adjust:
Having extension run usual command, like mvn package
. Verify the caching engine is activated:
cache
next to the usual local repository
.buildinfo.xml
in the cache repository for typical module and review it. Ensure thatIt is recommended to find the best working trade-off between fairness and cache efficiency. Adding unnecessary rules and checks could reduce both performance and cache efficiency (hit rate).
To leverage remote cache feature there should a shared storage provide. Any technology supported by Maven Wagon will suffice. In simplest form it could be a http web server which supports get/put operations (Nginx OSS with fs module or any other equivalent). See Remote cache setup for detailed description of cache setup.