Class AbstractTemplateToolMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractToolMojo
net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AbstractPackageToolMojo
public abstract class AbstractTemplateToolMojo extends AbstractToolMojo
Base class for Mojos operating with templates.
The Freemarker Java Template Engine is used for the templates.
- Author:
- Bernd Eilers
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classAbstractTemplateToolMojo.TemplateGeneratorInternal class for the template generator. -
Field Summary
Fields Modifier and Type Field Description protected java.io.FileoutputDirectoyTemplatesOutput directory where templates are stored when they have been read from internal resource: URLs.protected AbstractTemplateToolMojo.TemplateGeneratortemplateGeneratorFields inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractToolMojo
buildDirectory, classpathArtifacts, excludedArtifacts, javaVersion, jdkToolchain, jpacktoolModel, jpacktoolPropertyPrefix, locationManager, mavenProjectHelper, outputDirectoryAutomaticJars, outputDirectoryClasspathJars, outputDirectoryJPacktool, outputDirectoryModules, project, session, shouldSkipReason, skip, systemModules, templateMap, toolchainManager, verbose, zipArchiver -
Constructor Summary
Constructors Constructor Description AbstractTemplateToolMojo()Constructor. -
Method Summary
Modifier and Type Method Description protected voidgenerateFromTemplate(java.lang.String templateName, java.io.File outputFile)AbstractTemplateToolMojo.TemplateGeneratorgetTemplateGenerator()protected java.util.Map<java.lang.String,java.lang.Object>getTemplateMap()protected java.lang.StringinitTemplate(java.lang.String res, java.lang.String template)protected voidinitTemplates()Initialize Templates copy them from resource: URLs to the filesystem.protected java.lang.StringloadResourceFileIntoString(java.lang.String path)Methods inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractToolMojo
bytesToHex, checkShouldSkip, createZipArchiveFromDirectory, execute, executeCommand, executeToolFinish, executeToolMain, executeToolStart, getArtifactFile, getClasspathArtifacts, getExcludedArtifacts, getFinalName, getJavaVersion, getJdkToolchain, getJpacktoolPropertyPrefix, getLocationManager, getOutputDirectoryAutomaticJars, getOutputDirectoryClasspathJars, getOutputDirectoryJPacktool, getOutputDirectoryModules, getPluginVersion, getProject, getSession, getShouldSkipReason, getSystemModules, getToolchain, getToolchainManager, getToolExecutable, hasClassifier, isVerbose, publishJPacktoolProperties, publishSHA256, setShouldSkipReason
-
Field Details
-
outputDirectoyTemplates
@Parameter(defaultValue="${project.build.directory}/jpacktool/templates", required=true, readonly=true) protected java.io.File outputDirectoyTemplatesOutput directory where templates are stored when they have been read from internal resource: URLs. -
templateGenerator
-
-
Constructor Details
-
AbstractTemplateToolMojo
public AbstractTemplateToolMojo()Constructor.
-
-
Method Details
-
initTemplates
protected void initTemplates() throws org.apache.maven.plugin.MojoFailureExceptionInitialize Templates copy them from resource: URLs to the filesystem.Can be implemented in derived classes the base class method does nothing.
- Throws:
org.apache.maven.plugin.MojoFailureException- on plugin failure
-
loadResourceFileIntoString
protected java.lang.String loadResourceFileIntoString(java.lang.String path) throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
initTemplate
protected java.lang.String initTemplate(java.lang.String res, java.lang.String template) throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
getTemplateMap
protected java.util.Map<java.lang.String,java.lang.Object> getTemplateMap() -
generateFromTemplate
protected void generateFromTemplate(java.lang.String templateName, java.io.File outputFile) throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
getTemplateGenerator
-