Package org.tentackle.maven.plugin.jlink
Class AbstractJlinkMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.tentackle.maven.AbstractTentackleMojo
-
- org.tentackle.maven.plugin.jlink.AbstractJlinkMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
InitMojo,JlinkMojo,JpackageMojo
public abstract class AbstractJlinkMojo extends org.tentackle.maven.AbstractTentackleMojoBase jlink mojo.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description AbstractJlinkMojo()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcopyArtifacts(JlinkResolver.Result result)Copies artifacts not already in the created jlink image to module- or classpath.protected abstract voidcreateImage(JlinkResolver.Result result)Creates the application image.voidexecuteImpl()java.util.List<java.lang.String>getAddModules()Gets extra jre or jdk modules to add to the image.protected java.io.FilegetApplicationDirectory()Gets the application directory.java.util.List<java.lang.String>getExcludeModules()Gets modules to exclude.abstract java.io.FilegetImageDirectory()Gets the directory created by jlink holding the image.java.io.FilegetJdepsTool()Gets the jdeps tool.org.codehaus.plexus.languages.java.jpms.LocationManagergetLocationManager()Gets the location manager to extract module information.java.lang.StringgetMainClass()Gets the name of the main class.java.lang.StringgetMainModule()Gets the name of the module holding the main class.java.lang.StringgetNameTemplate()Gets the name of the name template.org.apache.maven.project.MavenProjectHelpergetProjectHelper()Gets the project helper to attach artifacts.java.lang.StringgetRunTemplate()Gets the name of the runner template.java.io.FilegetTemplateDir()Gets the template directory.java.lang.StringgetUpdateTemplate()Gets the name of the update template.protected voidinstallTemplates()Copies the templates to the template directory.
Overwrites any existing templates.booleanisClasspathDependency(org.apache.maven.artifact.Artifact artifact)Returns whether an artifact should be moved to the classpath explicitly.voidprepareExecute()protected booleanvalidate()-
Methods inherited from class org.tentackle.maven.AbstractTentackleMojo
determineEncoding, determineVerbosity, execute, findResourceDirs, finishExecute, getCanonicalPath, getMavenProject, getMavenSession, getPathRelativeToBasedir, getResourceDirName, getSettings, getSettingsDecrypter, getToolChain, getToolchainManager, getToolFinder, loadResourceFileIntoString
-
-
-
-
Method Detail
-
getTemplateDir
public java.io.File getTemplateDir()
Gets the template directory.- Returns:
- the directory holding the wizard templates
-
getImageDirectory
public abstract java.io.File getImageDirectory()
Gets the directory created by jlink holding the image.- Returns:
- the image dir, never null
-
getMainModule
public java.lang.String getMainModule()
Gets the name of the module holding the main class.- Returns:
- the main module, null to build an application running on the classpath
-
getMainClass
public java.lang.String getMainClass()
Gets the name of the main class.- Returns:
- the main class, never null
-
getLocationManager
public org.codehaus.plexus.languages.java.jpms.LocationManager getLocationManager()
Gets the location manager to extract module information.- Returns:
- the JPMS manager
-
getProjectHelper
public org.apache.maven.project.MavenProjectHelper getProjectHelper()
Gets the project helper to attach artifacts.- Returns:
- the project helper
-
getJdepsTool
public java.io.File getJdepsTool()
Gets the jdeps tool.- Returns:
- the file, never null
-
getNameTemplate
public java.lang.String getNameTemplate()
Gets the name of the name template.- Returns:
- the template to generate the name of the runner script
-
getRunTemplate
public java.lang.String getRunTemplate()
Gets the name of the runner template.- Returns:
- the template to generate the runner script
-
getUpdateTemplate
public java.lang.String getUpdateTemplate()
Gets the name of the update template.- Returns:
- the template to generate the update script, null if none
-
getAddModules
public java.util.List<java.lang.String> getAddModules()
Gets extra jre or jdk modules to add to the image.- Returns:
- extra module names, never null
-
getExcludeModules
public java.util.List<java.lang.String> getExcludeModules()
Gets modules to exclude.- Returns:
- excluded module names, never null
-
prepareExecute
public void prepareExecute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Overrides:
prepareExecutein classorg.tentackle.maven.AbstractTentackleMojo- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
executeImpl
public void executeImpl() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Specified by:
executeImplin classorg.tentackle.maven.AbstractTentackleMojo- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
createImage
protected abstract void createImage(JlinkResolver.Result result) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
Creates the application image.- Parameters:
result- the resolver info- Throws:
org.apache.maven.plugin.MojoExecutionException- if building the JPMS info failedorg.apache.maven.plugin.MojoFailureException- if jlink returned an error code
-
getApplicationDirectory
protected java.io.File getApplicationDirectory()
Gets the application directory.- Returns:
- the destination base directory for the application
-
copyArtifacts
protected void copyArtifacts(JlinkResolver.Result result) throws org.apache.maven.plugin.MojoExecutionException
Copies artifacts not already in the created jlink image to module- or classpath.- Parameters:
result- the resolver info- Throws:
org.apache.maven.plugin.MojoExecutionException- if copy failed
-
validate
protected boolean validate() throws org.apache.maven.plugin.MojoExecutionException- Overrides:
validatein classorg.tentackle.maven.AbstractTentackleMojo- Throws:
org.apache.maven.plugin.MojoExecutionException
-
isClasspathDependency
public boolean isClasspathDependency(org.apache.maven.artifact.Artifact artifact)
Returns whether an artifact should be moved to the classpath explicitly.- Parameters:
artifact- the artifact- Returns:
- true if move to classpath, else modulepath
-
installTemplates
protected void installTemplates() throws org.apache.maven.plugin.MojoExecutionExceptionCopies the templates to the template directory.
Overwrites any existing templates.- Throws:
org.apache.maven.plugin.MojoExecutionException- if failed
-
-