Note that this is a parent pom that builds something outside of its hierarchy. The ../path/to/some/moduledoes have a .git directory, but this project where this parent pom.xml resides does not.
This fails with the following exception:
[ERROR] Failed to execute goal io.github.phillipuniverse:githook-maven-plugin:1.0.2-SNAPSHOT:install (default) on project broadleaf-microservices-build-parent: Execution default of goal io.github.phillipuniverse:githook-maven-plugin:1.0.2-SNAPSHOT:install failed: One of setGitDir or setWorkTree must be called. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.github.phillipuniverse:githook-maven-plugin:1.0.2-SNAPSHOT:install (default) on project broadleaf-microservices-build-parent: Execution default of goal io.github.phillipuniverse:githook-maven-plugin:1.0.2-SNAPSHOT:install failed: One of setGitDir or setWorkTree must be called.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
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)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal io.github.phillipuniverse:githook-maven-plugin:1.0.2-SNAPSHOT:install failed: One of setGitDir or setWorkTree must be called.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: java.lang.IllegalArgumentException: One of setGitDir or setWorkTree must be called.
at org.eclipse.jgit.lib.BaseRepositoryBuilder.requireGitDirOrWorkTree(BaseRepositoryBuilder.java:623)
at org.eclipse.jgit.lib.BaseRepositoryBuilder.setup(BaseRepositoryBuilder.java:587)
at org.eclipse.jgit.storage.file.FileRepositoryBuilder.build(FileRepositoryBuilder.java:88)
at org.sandbox.GitHookInstallMojo.getHooksDir(GitHookInstallMojo.java:68)
at org.sandbox.GitHookInstallMojo.execute(GitHookInstallMojo.java:32)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more
The cause of this is that I am starting a search for the .git directory based on the CWD of the Java process. This should instead start where the project itself is located
Example pom.xml:
Note that this is a parent pom that builds something outside of its hierarchy. The
../path/to/some/module
does have a.git
directory, but this project where this parentpom.xml
resides does not.This fails with the following exception: