Depot Cache now supports Maven
We've added support for Maven to Depot Cache. This lets you instantly share your Maven cache between CI and local development environments.
If you're using Depot GitHub Actions runners, we've already pre-configured the runner to use Depot Cache when building Maven artifacts. We also support using Depot Cache in a Maven project outside of our runners.
You must configure a remote cache server in your ~/.m2/settings.xml
file. Configure Maven to use the Depot Cache service endpoints and set your API token where there is the DEPOT_TOKEN
below:
settings.xml
:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>depot-cache</id>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Bearer DEPOT_TOKEN</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
Next, you can configure the Maven Build Cache extension to use this server in .mvn/maven-build-cache-config.xml
:
<cache xmlns="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0 https://maven.apache.org/xsd/build-cache-config-1.0.0.xsd">
<configuration>
<enabled>true</enabled>
<hashAlgorithm>SHA-256</hashAlgorithm>
<validateXml>true</validateXml>
<remote enabled="true" saveToRemote="true" id="depot-cache">
<url>https://cache.depot.dev</url>
</remote>
<projectVersioning adjustMetaInf="true" />
</configuration>
</cache>
You can read more about configuring Maven to use Depot Cache in our Maven documentation.