-
Notifications
You must be signed in to change notification settings - Fork 51
Description
Affected version
1.2.0
Bug description
(re-opening because #354 got closed as duplicate although i could not see any relation to the linked issue.)
I create a minimal example for the issue (is it or is it by design) at hand:
https://github.com/warmuuh/buildcache-min-example
for this very simple project with this build cache config (attached), i see that although i dont run mvn package
(only mvn compile
), a buildinfo.xml is written to the local cache. on subsequent call to mvn test
, it skips compilation.
...
[INFO] Skipping plugin execution (cached): resources:resources
[INFO] Skipping plugin execution (cached): compiler:compile
...
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ buildcache-min-example ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 1 source file with javac [debug target 21] to target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
<because it cant find the compiled files>
I assumed that build cache is only triggered on package
phase, but in source code, i see that it always write the buildinfo.xml but omits artifacts, if not at least in "package" phase:
maven-build-cache-extension/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java
Line 552 in dcc89ad
localCache.saveBuildInfo(cacheResult, build); |
<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">
<!--
Template Maven build cache configuration
-->
<configuration>
<enabled>true</enabled>
<hashAlgorithm>SHA-256</hashAlgorithm>
<validateXml>true</validateXml>
<remote enabled="false" />
<local>
<maxBuildsCached>3</maxBuildsCached>
</local>
<projectVersioning adjustMetaInf="true"/>
<attachedOutputs>
<dirNames>
<dirName>classes</dirName>
</dirNames>
</attachedOutputs>
</configuration>
<input>
<global>
<glob>
{*.java,*.groovy,*.yaml,*.yml,*.svcd,*.proto,*assembly.xml,*.xml,*.vm,*.ini,*.jks,*.properties,*.sh,*.bat,*.jsp,*.tag,Dockerfile,*.xsd}
</glob>
<includes>
<include>src/</include>
</includes>
<excludes>
<exclude>pom.xml</exclude>
</excludes>
</global>
</input>
</cache>