frontend-maven-plugin
frontend-maven-plugin copied to clipboard
Fix windows bug
Stop an error from killing the build when it can't delete the temp directory.
Summary
Works around the issue from #749, which boils down to an error when deleting the temp directory. The crux of the problem is that Java must delete a folder's contents before deleting the directory itself (possibly an OS level requirement, but that is irrelevant). When deleting recursively, eventually a path becomes too long for windows.
Exception stack trace snippet:
...
Caused by: java.io.IOException: Unable to delete directory <redacted for privacy>\node\tmp\node-v10.16.0-win-x64\node_modules\npm\test\tap.
at org.apache.commons.io.FileUtils.deleteDirectory (FileUtils.java:873)
at org.apache.commons.io.FileUtils.forceDelete (FileUtils.java:1239)
at org.apache.commons.io.FileUtils.cleanDirectory (FileUtils.java:903)
at org.apache.commons.io.FileUtils.deleteDirectory (FileUtils.java:869)
at org.apache.commons.io.FileUtils.forceDelete (FileUtils.java:1239)
at org.apache.commons.io.FileUtils.cleanDirectory (FileUtils.java:903)
at org.apache.commons.io.FileUtils.deleteDirectory (FileUtils.java:869)
at org.apache.commons.io.FileUtils.forceDelete (FileUtils.java:1239)
at org.apache.commons.io.FileUtils.cleanDirectory (FileUtils.java:903)
at org.apache.commons.io.FileUtils.deleteDirectory (FileUtils.java:869)
at org.apache.commons.io.FileUtils.forceDelete (FileUtils.java:1239)
at org.apache.commons.io.FileUtils.cleanDirectory (FileUtils.java:903)
at org.apache.commons.io.FileUtils.deleteDirectory (FileUtils.java:869)
at org.apache.commons.io.FileUtils.forceDelete (FileUtils.java:1239)
at org.apache.commons.io.FileUtils.cleanDirectory (FileUtils.java:903)
at org.apache.commons.io.FileUtils.deleteDirectory (FileUtils.java:869)
at com.github.eirslett.maven.plugins.frontend.lib.NodeInstaller.deleteTempDirectory (NodeInstaller.java:320)
...
Tests and Documentation
Tested locally, on a windows machine, prints the following message when it installs node, but fails to delete the tempdir:
[WARNING] Temporary directory could not be deleted, please delete it manually. Tempdir location: <redacted for privacy>\node\tmp
@eirslett I'm not sure what caused the appveyor java 11 build failure, but the java 8 build worked, in addition the travis java 8 build worked. This is a pretty significant issue on windows, and would be nice to have this fix/workaround in soon