Class AbstractGitOutputMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
    Direct Known Subclasses:
    ChangelogMojo, ContributorsMojo

    abstract class AbstractGitOutputMojo
    extends AbstractGitMojo
    This abstract Mojo implements writing output to a PrintStream This is either System.out by default, but maybe another PrintStream object wrapped around a file given by outputFile.
    Since:
    0.2.2
    Author:
    Sebastian Staudt
    See Also:
    File, PrintStream
    • Field Detail

      • encoding

        @Parameter(property="mavanagaiata.encoding",
                   defaultValue="UTF-8")
        String encoding
        The encoding to use for generated output
      • footer

        @Parameter(property="mavanagaiata.footer",
                   defaultValue="\nGenerated by Mavanagaiata %s at %s")
        String footer
        The footer to print below the output
    • Constructor Detail

      • AbstractGitOutputMojo

        AbstractGitOutputMojo()
    • Method Detail

      • unescapeFormatNewlines

        static String unescapeFormatNewlines​(String format)
        Unescapes newlines for format strings
        Parameters:
        format - The escaped format string
        Returns:
        The unescaped format string
      • initConfiguration

        protected void initConfiguration()
      • getOutputFile

        public abstract File getOutputFile()
        Returns the output file for the generated content

        Has to be implemented by subclassing mojos, so that the output file can be easily configured.

        Returns:
        The output file for the generated content
      • run

        protected final void run​(GitRepository repository)
                          throws MavanagaiataMojoException
        Initializes the PrintStream to use This is System.out if no output file is given (default). Otherwise the parent directories of outputFile are created and a new PrintStream for that file is created.
        Specified by:
        run in class AbstractGitMojo
        Parameters:
        repository - The repository instance to use
        Throws:
        MavanagaiataMojoException - if the file specified by outputFile cannot be opened for writing or the target directory cannot be created
      • setOutputFile

        public abstract void setOutputFile​(File outputFile)
        Sets the output file for the generated content
        Parameters:
        outputFile - The output file for the generated content