Class AbstractGitMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.hazendaz.maven.makeself.AbstractGitMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
GitMojo, MakeselfMojo

public abstract class AbstractGitMojo extends org.apache.maven.plugin.AbstractMojo
Abstract base class providing portable Git download and installation support for Windows.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
    The path to existing git install for windows usage.
    protected PortableGit
    Portable Git.
    protected List<org.eclipse.aether.repository.RemoteRepository>
    Maven Remote Repositories.
    protected org.eclipse.aether.RepositorySystemSession
    Maven Repository System Session.
    protected org.eclipse.aether.RepositorySystem
    Maven Artifact Factory.

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

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Check Git Setup.
    protected void
    Extract Portable Git.
    protected void
    installGit(org.eclipse.aether.artifact.Artifact artifact, String location)
    Install Git extracts git to .m2/repository under PortableGit.
    protected boolean
    Returns true if the current platform is Windows.
    protected void
    Run installer executes a process and logs its output.

    Methods inherited from class org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.maven.plugin.Mojo

    execute
  • Field Details

    • gitPath

      @Parameter(defaultValue="", property="gitPath") protected String gitPath
      The path to existing git install for windows usage. If left blank per default, portable git will be used. Location should be something like 'C:/Program Files/Git'. When set and not windows, it will be treated as blank.
    • repositorySystem

      @Inject protected org.eclipse.aether.RepositorySystem repositorySystem
      Maven Artifact Factory.
    • repoSession

      @Parameter(defaultValue="${repositorySystemSession}", readonly=true, required=true) protected org.eclipse.aether.RepositorySystemSession repoSession
      Maven Repository System Session.
    • remoteRepositories

      @Parameter(defaultValue="${project.remoteProjectRepositories}", readonly=true, required=true) protected List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories
      Maven Remote Repositories.
    • portableGit

      protected PortableGit portableGit
      Portable Git.
  • Constructor Details

    • AbstractGitMojo

      public AbstractGitMojo()
  • Method Details

    • isWindows

      protected boolean isWindows()
      Returns true if the current platform is Windows. Extracted as a method to allow test subclasses to override the platform detection without modifying production code.
      Returns:
      true if running on Windows
    • checkGitSetup

      protected void checkGitSetup() throws org.apache.maven.plugin.MojoFailureException
      Check Git Setup.
      Throws:
      org.apache.maven.plugin.MojoFailureException - the mojo failure exception
    • extractPortableGit

      protected void extractPortableGit() throws org.apache.maven.plugin.MojoFailureException
      Extract Portable Git.
      Throws:
      org.apache.maven.plugin.MojoFailureException - failure retrieving portable git
    • installGit

      protected void installGit(org.eclipse.aether.artifact.Artifact artifact, String location)
      Install Git extracts git to .m2/repository under PortableGit.
      Parameters:
      artifact - the maven artifact representation for git
      location - the location in maven repository to store portable git
    • runInstaller

      protected void runInstaller(List<String> command) throws IOException, InterruptedException
      Run installer executes a process and logs its output.
      Parameters:
      command - the command to run
      Throws:
      IOException - Signals that an I/O exception has occurred.
      InterruptedException - the interrupted exception