Reputation: 747
I am currently introducing the Maven Build Cache Extension to a large project (EAR, multiple WARS, multiple JAR modules) to speed up build times.
https://maven.apache.org/extensions/maven-build-cache-extension/index.html
Pretty much standard (no customization) works perfectly fine for this build - since there is not that much special logic with plugins:
.mvn/extensions.xml
<extension>
<groupId>org.apache.maven.extensions</groupId>
<artifactId>maven-build-cache-extension</artifactId>
<version>1.1.0</version>
</extension>
.mvn/maven-build-cache-config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<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>XX</hashAlgorithm>
<projectVersioning adjustMetaInf="false"/>
<local>
<maxBuildsCached>5</maxBuildsCached>
</local>
<multiModule>
<discovery>
<scanProfiles>
<scanProfile>full</scanProfile>
</scanProfiles>
</discovery>
</multiModule>
</configuration>
<input>
<global>
<glob>*</glob>
<includes>
<include>src/</include>
</includes>
</global>
</input>
</cache>
QUESTION
Caching of modules and builds works fine, but restoring the main build artifact(s) in /target/ not.
When I do a mvn clean package
, the target build dirs are ofcourse deleted, but the main artifact (JAR, EAR, WARs) are not restored to /target.
Why are artifacts not restored to /target ?
I see output like this, which suggests that a restore should happen?
[INFO] Going to calculate checksum for project [groupId=com.xxx, artifactId=aaa]
[INFO] Going to calculate checksum for project [groupId=com.xxx, artifactId=bbb]
[INFO] Going to calculate checksum for project [groupId=com.xxx, artifactId=ccc]
[INFO] Project inputs calculated in 71 ms. XX checksum [fae782eba5969b98] calculated in 62 ms.
[INFO] Attempting to restore project com.xxx:yyy from build cache
[INFO] Local build found by checksum fae782eba5969b98
[INFO] Found cached build, restoring com.xxx:yyy from cache by checksum fae782eba5969b98
Upvotes: 0
Views: 581
Reputation: 747
It turns out to be a bug in all current versions (1.0.0 - 1.1.0): MBUILDCACHE-67
The next release (1.1.1-SNAPSHOT) fixes this problem.
Upvotes: 1