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
FieldsModifier and TypeFieldDescriptionprotected StringThe path to existing git install for windows usage.protected PortableGitPortable Git.protected List<org.eclipse.aether.repository.RemoteRepository> Maven Remote Repositories.protected org.eclipse.aether.RepositorySystemSessionMaven Repository System Session.protected org.eclipse.aether.RepositorySystemMaven Artifact Factory.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCheck Git Setup.protected voidExtract Portable Git.protected voidinstallGit(org.eclipse.aether.artifact.Artifact artifact, String location) Install Git extracts git to .m2/repository under PortableGit.protected booleanReturns true if the current platform is Windows.protected voidrunInstaller(List<String> command) Run installer executes a process and logs its output.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
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 repositorySystemMaven Artifact Factory. -
repoSession
@Parameter(defaultValue="${repositorySystemSession}", readonly=true, required=true) protected org.eclipse.aether.RepositorySystemSession repoSessionMaven Repository System Session. -
remoteRepositories
@Parameter(defaultValue="${project.remoteProjectRepositories}", readonly=true, required=true) protected List<org.eclipse.aether.repository.RemoteRepository> remoteRepositoriesMaven Remote Repositories. -
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.MojoFailureExceptionCheck Git Setup.- Throws:
org.apache.maven.plugin.MojoFailureException- the mojo failure exception
-
extractPortableGit
protected void extractPortableGit() throws org.apache.maven.plugin.MojoFailureExceptionExtract Portable Git.- Throws:
org.apache.maven.plugin.MojoFailureException- failure retrieving portable git
-
installGit
Install Git extracts git to .m2/repository under PortableGit.- Parameters:
artifact- the maven artifact representation for gitlocation- the location in maven repository to store portable git
-
runInstaller
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
-