You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2024/02/26 20:17:00 UTC

[jira] [Commented] (MSHARED-1330) Incremental builds fail on filtered read-only resources

    [ https://issues.apache.org/jira/browse/MSHARED-1330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17820850#comment-17820850 ] 

ASF GitHub Bot commented on MSHARED-1330:
-----------------------------------------

gnodet opened a new pull request, #97:
URL: https://github.com/apache/maven-filtering/pull/97

   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MSHARED) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [ ] Each commit in the pull request should have a meaningful subject line and body.
    - [ ] Format the pull request title like `[MSHARED-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MSHARED-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [ ] Run `mvn clean verify -Prun-its` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [ ] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   




> Incremental builds fail on filtered read-only resources  
> ---------------------------------------------------------
>
>                 Key: MSHARED-1330
>                 URL: https://issues.apache.org/jira/browse/MSHARED-1330
>             Project: Maven Shared Components
>          Issue Type: Bug
>          Components: maven-filtering
>            Reporter: G.Vaysman
>            Priority: Major
>         Attachments: create-license.zip
>
>
> 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) }}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)