Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Under certain SCM's, such as Perforce, files under ./src are read-only. With the latest maven-resources-plugin (3.3.1) which has maven-filtering 3.3.1 as a dependency, filtered resources end up as read-only in ./target. Since filtered resources are always updated in target, this fails with exception below. This worked in maven-resources-plugin 2.7, but seems to break, at least, starting from maven-resources-plugin 3.0.0. Additionally note, that deprecating certain maven-filtering methods (copyFile, etc) that take the Boolean overwrite has broken the maven-resource-plugin contract for the resources:resources (see https://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html).
I am attaching a very simple project that demonstrates it. When unzipping, make sure src/main/resources/license.txt is read-only. Execute mvn install twice (without "clean") . It fails on both Windows and Linux.
Further, a kind of semi-independent issue is the following: if a module contains multiple resources, some to be filtered and others not, a typical Maven pattern is (abridged):
<resources>
<resource>
<filtering>true</filtering>
<includes> ... </includes>
</resource>
<resource>
<filtering>false</filtering>
<excludes> ... </excludes>
</resource>
</resources>
This causes both filtered and unfiltered resources go through maven-filtering, and it breaks incremental builds on unfiltered resources as well.
Error:
Caused by: java.io.FileNotFoundException: D:\tmp\create-license\target\classes\license.txt (Access is denied)
at java.io.RandomAccessFile.open0 (Native Method)
at java.io.RandomAccessFile.open (RandomAccessFile.java:346)
at java.io.RandomAccessFile.<init> (RandomAccessFile.java:260)
at java.io.RandomAccessFile.<init> (RandomAccessFile.java:215)
at org.apache.maven.shared.filtering.FilteringUtils.copyFile (FilteringUtils.java:348)
at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile (DefaultMavenFileFilter.java:104)
at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources (DefaultMavenResourcesFiltering.java:268)
at org.apache.maven.plugins.resources.ResourcesMojo.execute (ResourcesMojo.java:343)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
Attachments
Attachments
Issue Links
- links to