Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin throws FileAlreadyExistsException if git hook script already exists #5

Closed
lukewhitt opened this issue Feb 5, 2019 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@lukewhitt
Copy link
Contributor

I've installed the plugin on a project and it is working wonderfully. However, when running mvn clean install twice in a row on the project, the following is printed in the build output:

[WARNING] Could not move file into .git/hooks directory
java.nio.file.FileAlreadyExistsException: <path>/.git/hooks/commit-msg
    at sun.nio.fs.UnixCopyFile.copy (UnixCopyFile.java:573)
    at sun.nio.fs.UnixFileSystemProvider.copy (UnixFileSystemProvider.java:254)
    at java.nio.file.Files.copy (Files.java:1294)
    at com.rudikershaw.gitbuildhook.InstallMojo.installGitHook (InstallMojo.java:102)
    at com.rudikershaw.gitbuildhook.InstallMojo.execute (InstallMojo.java:86)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
@rudikershaw
Copy link
Owner

This seems to be symptomatic of a bigger problem. You can't update your hooks because it won't write over the old file.

@rudikershaw rudikershaw added this to the 2.0.2 milestone Feb 5, 2019
lukewhitt added a commit to lukewhitt/git-build-hook that referenced this issue Feb 5, 2019
rudikershaw added a commit that referenced this issue Feb 5, 2019
#5 Add StandardCopyOption to allow git hooks to be overriden.
@rudikershaw rudikershaw self-assigned this Sep 11, 2019
@rudikershaw rudikershaw added the bug Something isn't working label Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants