Workaround for GRADLE-2499


(Björn Kautler) #1

Does anyone have a solution or workaround for the bug I posted at GRADLE-2499? I’d really like to upgrade my Gradle version using the build comparing.


(Björn Kautler) #2

Noone? :frowning:


(spencer_allain) #3

The only workaround I can recommend would be to run the comparison under a different operating system other than windows (assuming this is possible with your build and environment).

If there is an actual live reference, or Windows somehow believes there is one, to the file being deleted, Windows will not allow the delete to occur, and you can see from the FileUtils.move() code, that move() removes the destination file if the original file cannot be deleted before spitting out the IOException.

1816
         boolean rename = srcFile.renameTo(destFile);
 1817
         if (!rename) {
 1818
             copyFile( srcFile, destFile );
 1819
             if (!srcFile.delete()) {
 1820
                 FileUtils.deleteQuietly(destFile);
 1821
                 throw new IOException("Failed to delete original file '" + srcFile +
 1822
                         "' after copy to '" + destFile + "'");
 1823
             }
 1824
         }
 1825
     }

-Spencer


(Björn Kautler) #4

As I fixed my problem as described in the comment to the issue, could someone please mark this question as anwered? :slight_smile: