public class VelocityTemplate
extends java.lang.Object
A component to work with VelocityTemplates from within plugins.
You will need to reference the velocity component as a parameter in your plugin. Like this:
/** * Velocity Component * @component */ private VelocityComponent velocity;
| Modifier and Type | Field and Description |
|---|---|
private org.apache.maven.plugin.logging.Log |
log |
private java.lang.String |
templateDirectory |
private org.codehaus.plexus.velocity.VelocityComponent |
velocity |
| Constructor and Description |
|---|
VelocityTemplate(org.codehaus.plexus.velocity.VelocityComponent velocityComponent,
java.lang.String templateBaseDirectory) |
| Modifier and Type | Method and Description |
|---|---|
void |
generate(java.lang.String outputFilename,
java.lang.String template,
org.apache.velocity.context.Context context)
Using a specified Velocity Template and provided context, create the outputFilename.
|
org.apache.maven.plugin.logging.Log |
getLog() |
java.lang.String |
getTemplateDirectory() |
org.codehaus.plexus.velocity.VelocityComponent |
getVelocity() |
void |
setLog(org.apache.maven.plugin.logging.Log log) |
void |
setTemplateDirectory(java.lang.String templateDirectory) |
void |
setVelocity(org.codehaus.plexus.velocity.VelocityComponent velocity) |
private java.lang.String templateDirectory
private org.apache.maven.plugin.logging.Log log
private org.codehaus.plexus.velocity.VelocityComponent velocity
public VelocityTemplate(org.codehaus.plexus.velocity.VelocityComponent velocityComponent,
java.lang.String templateBaseDirectory)
public java.lang.String getTemplateDirectory()
public org.codehaus.plexus.velocity.VelocityComponent getVelocity()
public void generate(java.lang.String outputFilename,
java.lang.String template,
org.apache.velocity.context.Context context)
throws org.apache.velocity.exception.VelocityException,
org.apache.maven.plugin.MojoExecutionException,
java.io.IOException
outputFilename - the file to be generated.template - the velocity template to use.context - the velocity context map.org.apache.velocity.exception.VelocityException - if the template was not found or any other Velocity exception.org.apache.maven.plugin.MojoExecutionException - if merging the velocity template failed.java.io.IOException - if there was an error when writing to the output file.public void setTemplateDirectory(java.lang.String templateDirectory)
public void setVelocity(org.codehaus.plexus.velocity.VelocityComponent velocity)
public org.apache.maven.plugin.logging.Log getLog()
public void setLog(org.apache.maven.plugin.logging.Log log)