Package org.codehaus.modello.maven
Class AbstractModelloGeneratorMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.codehaus.modello.maven.AbstractModelloGeneratorMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AbstractModelloSourceGeneratorMojo,ModelloJsonSchemaGeneratorMojo,ModelloVelocityMojo,ModelloXdocMojo,ModelloXsdMojo
public abstract class AbstractModelloGeneratorMojo extends org.apache.maven.plugin.AbstractMojo
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringbasedirBase directory of the project, from where the Modello models are loaded.private org.codehaus.plexus.build.BuildContextbuildContextprivate java.io.FilelicenseFileThe file that contains license header text.private java.lang.StringlicenseTextThe contents of license header text, verbatim.private org.codehaus.modello.core.ModelloCoremodelloCoreNote: This is passed by Maven and must not be configured by the user.private java.lang.String[]modelsList of relative paths to mdo files containing the models.private java.util.List<java.lang.String>packagedVersionsAdditional historical versions to generate, each being packaged with the version regardless of thepackageWithVersionsetting.private booleanpackageWithVersionTrue if the generated package names should include the version.private java.util.Map<java.lang.String,java.lang.String>pluralExceptionsAdditional exceptions to the singularization rules, changing plural noun to singular.private org.apache.maven.project.MavenProjectprojectThe Maven project instance for the executing project.private java.lang.StringversionThe version of the model we will be working on.
-
Constructor Summary
Constructors Constructor Description AbstractModelloGeneratorMojo()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.String,java.lang.Object>createParameters()Creates a Properties objects.protected voidcustomizeParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)Override this method to customize the values in the properties set.private voiddoExecute(java.lang.String modelStr, java.lang.String outputDirectory, java.util.Map<java.lang.String,java.lang.Object> parameters)Performs execute on a single specified model.voidexecute()java.lang.StringgetBasedir()protected abstract java.lang.StringgetGeneratorType()org.codehaus.modello.core.ModelloCoregetModelloCore()java.lang.String[]getModels()abstract java.io.FilegetOutputDirectory()booleangetPackageWithVersion()org.apache.maven.project.MavenProjectgetProject()java.lang.StringgetVersion()protected booleanproducesCompilableResult()protected booleanproducesResources()voidsetBasedir(java.lang.String basedir)voidsetBuildContext(org.codehaus.plexus.build.BuildContext context)voidsetModelloCore(org.codehaus.modello.core.ModelloCore modelloCore)voidsetModels(java.lang.String[] models)voidsetPackagedVersions(java.util.List<java.lang.String> packagedVersions)voidsetPackageWithVersion(boolean packageWithVersion)voidsetProject(org.apache.maven.project.MavenProject project)voidsetVersion(java.lang.String version)
-
-
-
Field Detail
-
basedir
@Parameter(defaultValue="${basedir}", required=true) private java.lang.String basedirBase directory of the project, from where the Modello models are loaded.
-
models
@Parameter(required=true) private java.lang.String[] models
List of relative paths to mdo files containing the models.
-
version
@Parameter(property="version", required=true) private java.lang.String versionThe version of the model we will be working on.
-
packageWithVersion
@Parameter(property="packageWithVersion", defaultValue="false", required=true) private boolean packageWithVersionTrue if the generated package names should include the version.
-
modelloCore
@Component private org.codehaus.modello.core.ModelloCore modelloCore
Note: This is passed by Maven and must not be configured by the user.
-
project
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject projectThe Maven project instance for the executing project.
-
packagedVersions
@Parameter private java.util.List<java.lang.String> packagedVersions
Additional historical versions to generate, each being packaged with the version regardless of thepackageWithVersionsetting.
-
licenseText
@Parameter private java.lang.String licenseText
The contents of license header text, verbatim.- Since:
- 2.3.1
-
licenseFile
@Parameter private java.io.File licenseFile
The file that contains license header text. If both configured, thelicenseTextprevails.- Since:
- 2.3.1
-
pluralExceptions
@Parameter private java.util.Map<java.lang.String,java.lang.String> pluralExceptions
Additional exceptions to the singularization rules, changing plural noun to singular.As a key we provide plural noun and as value we provide singular noun, example:
<kisses>kiss</kisses>- Since:
- 2.5.0
-
buildContext
@Component private org.codehaus.plexus.build.BuildContext buildContext
- Since:
- 1.0.1
-
-
Method Detail
-
getGeneratorType
protected abstract java.lang.String getGeneratorType()
-
getOutputDirectory
public abstract java.io.File getOutputDirectory()
-
producesCompilableResult
protected boolean producesCompilableResult()
-
producesResources
protected boolean producesResources()
-
createParameters
protected java.util.Map<java.lang.String,java.lang.Object> createParameters()
Creates a Properties objects.
The abstract mojo will override the output directory, the version and the package with version flag.- Returns:
- the parameters
-
customizeParameters
protected void customizeParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
Override 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.
- Parameters:
parameters- the parameters to customize
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
doExecute
private void doExecute(java.lang.String modelStr, java.lang.String outputDirectory, java.util.Map<java.lang.String,java.lang.Object> parameters) throws org.apache.maven.plugin.MojoExecutionExceptionPerforms execute on a single specified model.- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getBasedir
public java.lang.String getBasedir()
-
setBasedir
public void setBasedir(java.lang.String basedir)
-
getVersion
public java.lang.String getVersion()
-
setVersion
public void setVersion(java.lang.String version)
-
getPackageWithVersion
public boolean getPackageWithVersion()
-
setPackageWithVersion
public void setPackageWithVersion(boolean packageWithVersion)
-
getModelloCore
public org.codehaus.modello.core.ModelloCore getModelloCore()
-
setModelloCore
public void setModelloCore(org.codehaus.modello.core.ModelloCore modelloCore)
-
setBuildContext
public void setBuildContext(org.codehaus.plexus.build.BuildContext context)
-
getProject
public org.apache.maven.project.MavenProject getProject()
-
setProject
public void setProject(org.apache.maven.project.MavenProject project)
-
setPackagedVersions
public void setPackagedVersions(java.util.List<java.lang.String> packagedVersions)
-
getModels
public java.lang.String[] getModels()
- Returns:
- Returns the paths to the models.
-
setModels
public void setModels(java.lang.String[] models)
- Parameters:
models- Sets the paths to the models.
-
-