Class ModelloVelocityMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.codehaus.modello.maven.AbstractModelloGeneratorMojo
org.codehaus.modello.maven.ModelloVelocityMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
@Mojo(name="velocity",
defaultPhase=GENERATE_SOURCES,
threadSafe=true)
public class ModelloVelocityMojo
extends AbstractModelloGeneratorMojo
Creates files from the model using Velocity templates.
This mojo can be given a list of templates and a list of parameters.
Each template from the templates property will be run with the following context:
version: the version of the model to generatemodel: the modello modelHelper: aHelperobject instance- any additional parameters specified using the
paramsproperty
#MODELLO-VELOCITY#SAVE-OUTPUT-TO
VTL directive.
This allows a single template to generate multiple files. For example, the following
directive will redirect further output from the template to a file named
org/apache/maven/api/model/Plugin.java if the variable package is set to
org.apache.maven.api.model and the variable className is set to Plugin.
#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java
-
Field Summary
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcustomizeParameters(Map<String, Object> parameters) Override this method to customize the values in the properties set.protected Stringprotected booleanMethods inherited from class AbstractModelloGeneratorMojo
createParameters, execute, getBasedir, getModelloCore, getModels, getPackageWithVersion, getProject, getVersion, producesResources, setBasedir, setBuildContext, setModelloCore, setModels, setPackagedVersions, setPackageWithVersion, setProject, setVersionMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Constructor Details
-
ModelloVelocityMojo
public ModelloVelocityMojo()
-
-
Method Details
-
getGeneratorType
- Specified by:
getGeneratorTypein classAbstractModelloGeneratorMojo
-
customizeParameters
Description copied from class:AbstractModelloGeneratorMojoOverride this method to customize the values in the properties set.This method will be called after the parameters have been populated with the parameters in the abstract mojo.
- Overrides:
customizeParametersin classAbstractModelloGeneratorMojo- Parameters:
parameters- the parameters to customize
-
producesCompilableResult
protected boolean producesCompilableResult()- Overrides:
producesCompilableResultin classAbstractModelloGeneratorMojo
-
getOutputDirectory
- Specified by:
getOutputDirectoryin classAbstractModelloGeneratorMojo
-