Plexus Utils
  1. Plexus Utils
  2. PLXUTILS-139

FileUtils.copyFile() ignores 'overwrite' when 'wrappers' (FilterWrappers[]) is non-empty

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.7
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Windows
    • Number of attachments :
      0

      Description

      maven-resource-plugin is copying a resource even if it is unchanged and 'overwrite' is false. See http://stackoverflow.com/questions/3970157/is-there-a-way-to-force-maven-to-copy-resource-folder-changes-incrementally/5914467#5914467

      I chased the problem down to org.codehaus.plexus.util.FileUtils.copyFile() method. It is this method that is called by the maven-resource-plugin to ultimately copy the resource; the copyFile() method takes an 'overwrite' parameter, which the resource-plugin does pass in (and the default is indeed false), BUT...

      The copyFile() method ignores the 'overwrite' parameter if the list of filter-wrappers passed is non-empty! And if you have filtering set to true for your resources, this list is indeed non-empty.

      I can understand the reasoning behind copyFile() ignoring the 'overwrite': just because the destination file is newer does not mean that new filtered-file will be the same (i.e. the values for the variables in your resource file may have been changed since the last filtering).
      Ignoring the 'overwrite' flag is "convenient" for the FileUtils implementor. But this comes at a great price; a single resource file unnecessarily updated can trigger off time-consuming but redundant processes (i.e. rebuilding a jar-with-dependencies in my case). This may only be a few seconds but can be enough to disrupt the flow of an intensive code-compile-test cycle.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Rupinder S. Gill
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: