[
https://issues.apache.org/jira/browse/MBUILDCACHE-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17946429#comment-17946429
]
Sebastian Tiemann commented on MBUILDCACHE-116:
-----------------------------------------------
Hey,
I had a look at what you described and tested against versions 1.2.0 and 1.1.0
with your dependecy-plugin configuration in a small project.
In both versions, I could observe what you mentioned and I see no bug here.
This is the current default behaviour. The JAR file is moved to a cache entry
and restored to the target-directory if you run "mvn verify" again.
To achieve the restoration of other files and directories, you should add a
configuration file for the build cache extension, depending on your needs.
For details, have a look at the
[documentation|https://maven.apache.org/extensions/maven-build-cache-extension/getting-started.html#adding-build-cache-config],
paragraph "Adding build cache config".
This snippet, for example, will make sure, that the whole target/ is cached
(and restored):
{code:java}
<cache xmlns="http://maven.apache.org/BUILD-CACHE-CONFIG/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/BUILD-CACHE-CONFIG/1.2.0
https://maven.apache.org/xsd/build-cache-config-1.2.0.xsd">
<configuration>
<attachedOutputs>
<dirNames>
<dirName glob='*' />
</dirNames>
</attachedOutputs>
</configuration>
</cache>{code}
> Extension fails to regenerate all files in target directory
> -----------------------------------------------------------
>
> Key: MBUILDCACHE-116
> URL: https://issues.apache.org/jira/browse/MBUILDCACHE-116
> Project: Maven Build Cache Extension
> Issue Type: Bug
> Affects Versions: 1.2.0
> Reporter: Gili
> Priority: Major
>
> 1. Create a project with dependencies that contains:
> {code:java}
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-dependency-plugin</artifactId>
> <executions>
> <execution>
> <id>copy-dependencies</id>
> <phase>prepare-package</phase>
> <goals>
> <goal>copy-dependencies</goal>
> </goals>
> <configuration>
>
> <outputDirectory>${project.build.directory}/lib</outputDirectory>
> <overWriteReleases>false</overWriteReleases>
> <overWriteSnapshots>false</overWriteSnapshots>
> <overWriteIfNewer>true</overWriteIfNewer>
> <useBaseVersion>false</useBaseVersion>
> <includeScope>runtime</includeScope>
> </configuration>
> </execution>
> </executions>
> </plugin>{code}
> 2. Run "mvn verify".
> 3. Notice that the "target" directory contains the main JAR file and
> "target/lib" contains the JAR file's dependencies
> 4. Delete the target directory
> 5. Run "mvn verify" again.
> 6. Notice that "target" directory contains the main JAR file but the
> "target/lib" directory is missing.
> {*}Expected behavior{*}: "mvn verify" should always generate the same output.
> This might be a regression of
> https://issues.apache.org/jira/browse/MBUILDCACHE-67. Per
> [https://stackoverflow.com/q/78057064/14731] this issue existed back in
> version 1.0.1, was fixed by version 1.1.0, but it seems to be back now.
> Can someone please take a look at this?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)