Package com.diffplug.spotless.maven
Class SpotlessInstallPrePushHookMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.diffplug.spotless.maven.SpotlessInstallPrePushHookMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="install-git-pre-push-hook",
threadSafe=true)
public class SpotlessInstallPrePushHookMojo
extends org.apache.maven.plugin.AbstractMojo
A Maven Mojo responsible for installing a Git pre-push hook for the Spotless plugin.
This hook ensures that Spotless formatting rules are automatically checked and applied
before performing a Git push operation.
The class leverages GitPrePushHookInstallerMaven to perform the installation process
and uses a Maven logger to log installation events and errors to the console.
-
Field Summary
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the Mojo, installing the Git pre-push hook for the Spotless plugin.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Constructor Details
-
SpotlessInstallPrePushHookMojo
public SpotlessInstallPrePushHookMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureExceptionExecutes the Mojo, installing the Git pre-push hook for the Spotless plugin.This method creates an instance of
GitPrePushHookInstallerMaven, providing a logger for logging the process of hook installation and any potential errors. The installation process runs in the root directory of the current Maven project.- Throws:
org.apache.maven.plugin.MojoExecutionException- if an error occurs during the installation process.org.apache.maven.plugin.MojoFailureException- if the hook fails to install for any reason.
-