Due do this bug of cloning from SourceTree sometimes the .git/hooks directory is not created. If .git/hooks does not exist, this plugin fails with the following exception:
Caused by: java.nio.file.NoSuchFileException: /Users/..../ARepository/.git/hooks/pre-commit
at sun.nio.fs.UnixException.translateToIOException (UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel (UnixFileSystemProvider.java:214)
at java.nio.file.spi.FileSystemProvider.newOutputStream (FileSystemProvider.java:434)
at java.nio.file.Files.newOutputStream (Files.java:216)
at java.nio.file.Files.write (Files.java:3292)
at org.sandbox.GitHookInstallMojo.writeFile (GitHookInstallMojo.java:85)
at org.sandbox.GitHookInstallMojo.execute (GitHookInstallMojo.java:77)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
The NoSuchFileException is misleading, it's really caused by the fact that .git/hooks doesn't exist, and thus cannot write the pre-commit file into it.
Due do this bug of cloning from SourceTree sometimes the
.git/hooks
directory is not created. If.git/hooks
does not exist, this plugin fails with the following exception:The
NoSuchFileException
is misleading, it's really caused by the fact that.git/hooks
doesn't exist, and thus cannot write thepre-commit
file into it.