git-build-hook
git-build-hook copied to clipboard
Add a skip option to the Mojos
It would be nice to have a skip option on both Mojos.
We have a Maven archetype for a Maven project that uses this git hooks plugin, but the Maven archetype project itself does not use the git hooks plugin. The archetype project however runs integrations tests via archetype:integration-test. Since the archetype integration test plugin creates a temporary git project in target, and the archetype project already has an initialized .git folder, when the test Maven project is built, it creates a git hook in the archetype project. This hook then tries to run spotless, which doesn't exist in the archetype project.
A skip option would help to skip the git hooks plugin when running IT tests on the archetype project.
Hi there,
@themadprofessor has recently contributed individual skip options for each plugin goal in #50. I will release it with 3.5.0, but there is no ETA for the release at the moment.
I will close this issue once the release has gone out.
That sounds great. No need to hurry, it's not urgent, and there are also workarounds with setting the phase to none etc.
Hi @rudikershaw, I'd interested in skip option too, do you plan to release it soon?
If not, is there any way to skip hooks installation only in certain cases when running mvn install?
Hi @rudikershaw, I'd interested in skip option too, do you plan to release it soon? If not, is there any way to skip hooks installation only in certain cases when running
mvn install?
Replying to myself, it can be skipped by exposing the phase as prop:
<!-- Prop -->
<properties>
<git.hook.plugin.version>3.4.1</git.hook.plugin.version>
<git-build-hook-maven-plugin.phase>process-sources</git-build-hook-maven-plugin.phase>
</properties>
<!-- Plugin configuration -->
<plugin>
<groupId>com.rudikershaw.gitbuildhook</groupId>
<artifactId>git-build-hook-maven-plugin</artifactId>
<version>${git.hook.plugin.version}</version>
<configuration>
<installHooks>
<pre-commit>scripts/git-hooks/pre-commit</pre-commit>
</installHooks>
</configuration>
<executions>
<execution>
<goals>
<goal>install</goal>
</goals>
<phase>${git-build-hook-maven-plugin.phase}</phase>
</execution>
</executions>
</plugin>
So when running you could set the prop git-build-hook-maven-plugin.phase to none to skip the plugin:
# Will run the plugin by default
./mvnw package
# Won't run the plugin
./mvnw package -Dgit-build-hook-maven-plugin.phase=none
Hi all,
I have released a 3.5.0 which includes the skip parameters. It should be available within the next few hours.
My preferred method of skipping the plug-in before the addition of the skip options was define separate profiles. One with the plugin enabled (for development for example) and one with it disabled (for example, for CI).