Class AbstractToolMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractToolMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AbstractDependencyJarsMojo,AbstractTemplateToolMojo
public abstract class AbstractToolMojo
extends org.apache.maven.plugin.AbstractMojo
- Author:
- bei
-
Field Summary
Fields Modifier and Type Field Description protected java.io.FilebuildDirectoryprotected java.util.List<ArtifactParameter>classpathArtifactsArtifacts that should be explicitly on the classpathprotected java.util.List<ArtifactParameter>excludedArtifactsArtifacts that should be excludedprotected doublejavaVersionprotected java.util.Map<java.lang.String,java.lang.String>jdkToolchainSpecify the requirements for this jdk toolchain.protected java.util.Map<java.lang.String,java.lang.Object>jpacktoolModelprotected java.lang.StringjpacktoolPropertyPrefixprotected org.codehaus.plexus.languages.java.jpms.LocationManagerlocationManagerprotected org.apache.maven.project.MavenProjectHelpermavenProjectHelperThe MavenProjectHelperprotected java.io.FileoutputDirectoryAutomaticJarsprotected java.io.FileoutputDirectoryClasspathJarsprotected java.io.FileoutputDirectoryJPacktoolprotected java.io.FileoutputDirectoryModulesprotected org.apache.maven.project.MavenProjectprojectprotected org.apache.maven.execution.MavenSessionsessionprotected java.lang.StringshouldSkipReasonprotected booleanskipskip plugin execution.protected java.util.List<java.lang.String>systemModulesprotected java.util.Map<java.lang.String,java.lang.Object>templateMapprotected org.apache.maven.toolchain.ToolchainManagertoolchainManagerprotected booleanverboseThis will turn on verbose mode.protected org.codehaus.plexus.archiver.zip.ZipArchiverzipArchiverThe JAR archiver needed for archiving the environments. -
Constructor Summary
Constructors Constructor Description AbstractToolMojo() -
Method Summary
Modifier and Type Method Description protected static java.lang.StringbytesToHex(byte[] hash)voidcheckShouldSkip()protected java.io.FilecreateZipArchiveFromDirectory(java.io.File outputDirectory, java.io.File outputDirectoryToZip)voidexecute()protected voidexecuteCommand(org.codehaus.plexus.util.cli.Commandline cmd)voidexecuteToolFinish()abstract voidexecuteToolMain()voidexecuteToolStart()protected java.io.FilegetArtifactFile(java.io.File basedir, java.lang.String finalName, java.lang.String classifier, java.lang.String ext)Returns the artifact file to generate, based on an optional classifier.java.util.List<ArtifactParameter>getClasspathArtifacts()java.util.List<ArtifactParameter>getExcludedArtifacts()java.lang.StringgetFinalName()doublegetJavaVersion()java.util.Map<java.lang.String,java.lang.String>getJdkToolchain()java.lang.StringgetJpacktoolPropertyPrefix()org.codehaus.plexus.languages.java.jpms.LocationManagergetLocationManager()java.io.FilegetOutputDirectoryAutomaticJars()java.io.FilegetOutputDirectoryClasspathJars()java.io.FilegetOutputDirectoryJPacktool()java.io.FilegetOutputDirectoryModules()java.lang.StringgetPluginVersion()org.apache.maven.project.MavenProjectgetProject()org.apache.maven.execution.MavenSessiongetSession()java.lang.StringgetShouldSkipReason()java.util.List<java.lang.String>getSystemModules()org.apache.maven.toolchain.ToolchaingetToolchain()org.apache.maven.toolchain.ToolchainManagergetToolchainManager()protected java.lang.StringgetToolExecutable(java.lang.String toolName)protected booleanhasClassifier(java.lang.String classifier)booleanisVerbose()protected voidpublishJPacktoolProperties()voidpublishSHA256(java.io.File file)voidsetShouldSkipReason(java.lang.String shouldSkipReason)
-
Field Details
-
buildDirectory
@Parameter(defaultValue="${project.build.directory}", required=true, readonly=true) protected java.io.File buildDirectory -
outputDirectoryJPacktool
@Parameter(defaultValue="${project.build.directory}/jpacktool", required=true, readonly=true) protected java.io.File outputDirectoryJPacktool -
outputDirectoryAutomaticJars
@Parameter(defaultValue="${project.build.directory}/jpacktool/autojar", required=true, readonly=true) protected java.io.File outputDirectoryAutomaticJars -
outputDirectoryClasspathJars
@Parameter(defaultValue="${project.build.directory}/jpacktool/jar", required=true, readonly=true) protected java.io.File outputDirectoryClasspathJars -
outputDirectoryModules
@Parameter(defaultValue="${project.build.directory}/jpacktool/jmods", required=true, readonly=true) protected java.io.File outputDirectoryModules -
jpacktoolPropertyPrefix
@Parameter(defaultValue="jpacktool", required=true, readonly=true) protected java.lang.String jpacktoolPropertyPrefix -
excludedArtifacts
Artifacts that should be excluded -
classpathArtifacts
Artifacts that should be explicitly on the classpath -
locationManager
@Component protected org.codehaus.plexus.languages.java.jpms.LocationManager locationManager -
toolchainManager
@Component protected org.apache.maven.toolchain.ToolchainManager toolchainManager -
zipArchiver
@Component(role=org.codehaus.plexus.archiver.Archiver.class, hint="zip") protected org.codehaus.plexus.archiver.zip.ZipArchiver zipArchiverThe JAR archiver needed for archiving the environments. -
mavenProjectHelper
@Component protected org.apache.maven.project.MavenProjectHelper mavenProjectHelperThe MavenProjectHelper -
project
@Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject project -
session
@Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession session -
systemModules
protected java.util.List<java.lang.String> systemModules -
verbose
@Parameter(defaultValue="false") protected boolean verboseThis will turn on verbose mode.The jlink/jpackager command line equivalent is:
--verbose -
skip
@Parameter(defaultValue="false") protected boolean skipskip plugin execution. -
jdkToolchain
@Parameter protected java.util.Map<java.lang.String,java.lang.String> jdkToolchainSpecify the requirements for this jdk toolchain. This overrules the toolchain selected by the maven-toolchain-plugin.
note: requires at least Maven 3.3.1 -
javaVersion
protected double javaVersion -
shouldSkipReason
protected java.lang.String shouldSkipReason -
jpacktoolModel
protected java.util.Map<java.lang.String,java.lang.Object> jpacktoolModel -
templateMap
protected java.util.Map<java.lang.String,java.lang.Object> templateMap
-
-
Constructor Details
-
AbstractToolMojo
public AbstractToolMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
executeToolStart
public void executeToolStart() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
executeToolMain
public abstract void executeToolMain() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
executeToolFinish
public void executeToolFinish() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
getPluginVersion
public java.lang.String getPluginVersion() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
checkShouldSkip
public void checkShouldSkip() -
getShouldSkipReason
public java.lang.String getShouldSkipReason() -
setShouldSkipReason
public void setShouldSkipReason(java.lang.String shouldSkipReason) -
getJavaVersion
public double getJavaVersion() -
getToolExecutable
protected java.lang.String getToolExecutable(java.lang.String toolName) throws java.io.IOException- Throws:
java.io.IOException
-
executeCommand
protected void executeCommand(org.codehaus.plexus.util.cli.Commandline cmd) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getToolchain
public org.apache.maven.toolchain.Toolchain getToolchain() -
getProject
public org.apache.maven.project.MavenProject getProject() -
getSession
public org.apache.maven.execution.MavenSession getSession() -
getOutputDirectoryJPacktool
public java.io.File getOutputDirectoryJPacktool() -
getOutputDirectoryAutomaticJars
public java.io.File getOutputDirectoryAutomaticJars() -
getOutputDirectoryClasspathJars
public java.io.File getOutputDirectoryClasspathJars() -
getOutputDirectoryModules
public java.io.File getOutputDirectoryModules() -
getJpacktoolPropertyPrefix
public java.lang.String getJpacktoolPropertyPrefix() -
getExcludedArtifacts
-
getClasspathArtifacts
-
getLocationManager
public org.codehaus.plexus.languages.java.jpms.LocationManager getLocationManager() -
getToolchainManager
public org.apache.maven.toolchain.ToolchainManager getToolchainManager() -
isVerbose
public boolean isVerbose() -
getJdkToolchain
public java.util.Map<java.lang.String,java.lang.String> getJdkToolchain() -
getSystemModules
public java.util.List<java.lang.String> getSystemModules() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getArtifactFile
protected java.io.File getArtifactFile(java.io.File basedir, java.lang.String finalName, java.lang.String classifier, java.lang.String ext)Returns the artifact file to generate, based on an optional classifier.- Parameters:
basedir- the output directoryfinalName- the name of the ear fileclassifier- an optional classifierext- The extension of the file.- Returns:
- the file to generate
-
hasClassifier
protected boolean hasClassifier(java.lang.String classifier) -
publishJPacktoolProperties
protected void publishJPacktoolProperties() -
bytesToHex
protected static java.lang.String bytesToHex(byte[] hash) -
publishSHA256
public void publishSHA256(java.io.File file) throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
createZipArchiveFromDirectory
protected java.io.File createZipArchiveFromDirectory(java.io.File outputDirectory, java.io.File outputDirectoryToZip) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getFinalName
public java.lang.String getFinalName()
-