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.File
buildDirectory
protected java.util.List<ArtifactParameter>
classpathArtifacts
Artifacts that should be explicitly on the classpathprotected java.util.List<ArtifactParameter>
excludedArtifacts
Artifacts that should be excludedprotected double
javaVersion
protected java.util.Map<java.lang.String,java.lang.String>
jdkToolchain
Specify the requirements for this jdk toolchain.protected java.util.Map<java.lang.String,java.lang.Object>
jpacktoolModel
protected java.lang.String
jpacktoolPropertyPrefix
protected org.codehaus.plexus.languages.java.jpms.LocationManager
locationManager
protected org.apache.maven.project.MavenProjectHelper
mavenProjectHelper
The MavenProjectHelperprotected java.io.File
outputDirectoryAutomaticJars
protected java.io.File
outputDirectoryClasspathJars
protected java.io.File
outputDirectoryJPacktool
protected java.io.File
outputDirectoryModules
protected org.apache.maven.project.MavenProject
project
protected org.apache.maven.execution.MavenSession
session
protected java.lang.String
shouldSkipReason
protected boolean
skip
skip plugin execution.protected java.util.List<java.lang.String>
systemModules
protected java.util.Map<java.lang.String,java.lang.Object>
templateMap
protected org.apache.maven.toolchain.ToolchainManager
toolchainManager
protected boolean
verbose
This will turn on verbose mode.protected org.codehaus.plexus.archiver.zip.ZipArchiver
zipArchiver
The JAR archiver needed for archiving the environments. -
Constructor Summary
Constructors Constructor Description AbstractToolMojo()
-
Method Summary
Modifier and Type Method Description protected static java.lang.String
bytesToHex(byte[] hash)
void
checkShouldSkip()
protected java.io.File
createZipArchiveFromDirectory(java.io.File outputDirectory, java.io.File outputDirectoryToZip)
void
execute()
protected void
executeCommand(org.codehaus.plexus.util.cli.Commandline cmd)
void
executeToolFinish()
abstract void
executeToolMain()
void
executeToolStart()
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.java.util.List<ArtifactParameter>
getClasspathArtifacts()
java.util.List<ArtifactParameter>
getExcludedArtifacts()
java.lang.String
getFinalName()
double
getJavaVersion()
java.util.Map<java.lang.String,java.lang.String>
getJdkToolchain()
java.lang.String
getJpacktoolPropertyPrefix()
org.codehaus.plexus.languages.java.jpms.LocationManager
getLocationManager()
java.io.File
getOutputDirectoryAutomaticJars()
java.io.File
getOutputDirectoryClasspathJars()
java.io.File
getOutputDirectoryJPacktool()
java.io.File
getOutputDirectoryModules()
java.lang.String
getPluginVersion()
org.apache.maven.project.MavenProject
getProject()
org.apache.maven.execution.MavenSession
getSession()
java.lang.String
getShouldSkipReason()
java.util.List<java.lang.String>
getSystemModules()
org.apache.maven.toolchain.Toolchain
getToolchain()
org.apache.maven.toolchain.ToolchainManager
getToolchainManager()
protected java.lang.String
getToolExecutable(java.lang.String toolName)
protected boolean
hasClassifier(java.lang.String classifier)
boolean
isVerbose()
protected void
publishJPacktoolProperties()
void
publishSHA256(java.io.File file)
void
setShouldSkipReason(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.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
executeToolStart
public void executeToolStart() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionException
org.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.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
executeToolFinish
public void executeToolFinish() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionException
org.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()
-