Maven Orb with alternative caching strategy


some time ago we created a new orb for Gradle, with new a caching strategy based on the git history. Now we have added a few improvements, and also published a corresponding orb for Maven.

In a nutshell, the orb looks into the git history for changes to the build files (poms), and so is able to restore the cache more often than the official orb - which uses a hash of the build files content and thus cannot restore the cache for any (even whitespace) changes to the build files.

So for incremental application updates, this results in less dependency downloads, saving time and transfer capacity. The downside to (almost) always being able to restore the cache, is that, as dependencies are updated, the cache will also contain outdated dependencies. And so those should be cleaned, or cache persist / restore will take longer.

While cleaning the Gradle cache could be done using some internal Gradle classes, Maven was not as straightforward. Invoking the dependency plugin and parsing the console output almost solved it, but would crash for certain artifacts, like AARs. In the end we went with a custom Maven agent (as in instrumentation) which records use pom files in the .m2 folder.

Feedback is welcome.

1 Like

Hi @skjolber,

This sounds like a great approach. The best way to get feedback on your orb(s) is through the community. By making your orb(s) public, the community can use them and provide you with very valuable feedback based on common use cases.