Class CleanJarMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="jar",
          defaultPhase=PACKAGE)
    public class CleanJarMojo
    extends org.apache.maven.plugin.AbstractMojo
    Plugin class for the goal jar. In this goal the jar is cleaned form unused folder entries and the size is set correct. Saves 4 bytes per entry.
    • Field Summary

      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        CleanJarMojo()
      The default constructor.
      protected CleanJarMojo​(org.apache.maven.plugin.logging.Log pLog, boolean pRepack)
      The constructor for testing.
    • Constructor Detail

      • CleanJarMojo

        public CleanJarMojo()
        The default constructor.
      • CleanJarMojo

        protected CleanJarMojo​(org.apache.maven.plugin.logging.Log pLog,
                               boolean pRepack)
        The constructor for testing.
        Parameters:
        pLog - the MockLog.
        pRepack - the param repack.
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException
        The implementation. Sets the main class if it is a module and the main class is not set but part of the manifest.
        Throws:
        org.apache.maven.plugin.MojoExecutionException - is thrown if an error occurs.
      • exec

        protected Path exec​(Path jarPath)
                     throws org.apache.maven.plugin.MojoExecutionException
        The main execute method to update the jar and clean it.
        Parameters:
        jarPath - the path to the artifact(jar).
        Returns:
        the new artifact.
        Throws:
        org.apache.maven.plugin.MojoExecutionException - is thrown if an IOException is thrown.