phillipuniverse / githook-maven-plugin

Maven plugin to install local git hooks
MIT License
28 stars 1 forks source link

Does not work in subfolder of multi-module maven project #3

Closed phillipuniverse closed 5 years ago

phillipuniverse commented 5 years ago
  1. Create a multi-module maven project with a layout like this:

    .git
    module1/
        -> pom.xml
    module2/
        -> pom.xml
    pom.xml
  2. Try to build any of the submodules, e.g.

    cd module1 && mvn initialize

This will fail with the following message:

[INFO] --- githook-maven-plugin:1.0.1:install (default) @ broadleaf-offer-services-metadata ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.476 s
[INFO] Finished at: 2019-02-06T19:12:12-06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.github.phillipuniverse:githook-maven-plugin:1.0.1:install (default) on project broadleaf-offer-services-metadata: Not a git repository, could not find .git/hooks directory -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Temporary workaround is to build from the parent, but specify a project list with -pl:

mvn initialize -pl module1 -am