Class ValidateMojo

  • All Implemented Interfaces:
    net.revelc.code.formatter.ConfigurationSource, org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="validate",
          defaultPhase=VALIDATE,
          requiresProject=true,
          threadSafe=true)
    public class ValidateMojo
    extends FormatterMojo
    This mojo is very similar to Formatter mojo, but it is focused on CI servers. If the code ain't formatted as expected this mojo will fail the build
    Author:
    marvin.froeder
    • Constructor Detail

      • ValidateMojo

        public ValidateMojo()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
                            org.apache.maven.plugin.MojoFailureException
        Description copied from class: FormatterMojo
        Execute.
        Specified by:
        execute in interface org.apache.maven.plugin.Mojo
        Overrides:
        execute in class FormatterMojo
        Throws:
        org.apache.maven.plugin.MojoExecutionException - the mojo execution exception
        org.apache.maven.plugin.MojoFailureException - the mojo failure exception
        See Also:
        Mojo.execute()
      • doFormatFile

        protected void doFormatFile​(File file,
                                    net.revelc.code.formatter.FormatterMojo.ResultCollector rc,
                                    Properties hashCache,
                                    String basedirPath,
                                    boolean dryRun)
                             throws IOException,
                                    org.apache.maven.plugin.MojoFailureException,
                                    org.eclipse.jface.text.BadLocationException,
                                    org.apache.maven.plugin.MojoExecutionException
        Description copied from class: FormatterMojo
        Format individual file.
        Overrides:
        doFormatFile in class FormatterMojo
        Parameters:
        file - the file
        rc - the rc
        hashCache - the hash cache
        basedirPath - the basedir path
        dryRun - the dry run
        Throws:
        IOException - Signals that an I/O exception has occurred.
        org.apache.maven.plugin.MojoFailureException - the mojo failure exception
        org.eclipse.jface.text.BadLocationException - the bad location exception
        org.apache.maven.plugin.MojoExecutionException - the mojo execution exception