Apache MyFaces
Project Documentation
Foundation

myfaces-builder:make-config

Creates taglib (tld) and faces-config files.

This Mojo actually provides a generic goal that will run a configurable velocity template file and generate a single output file. The template is passed the full metadata model object, and can select from the model whatever data it wants.

The execution can be configured with:

  • The name of the input template to be executed
  • The name of the output file to be created
  • Any number of variables which are accessable from the template (string values only)

The executed template has the following variables available to it:

  • model: the full metadata model for this project
  • modelIds: specifies which items from the model should be processed
  • baseContent: the full text of the contents of the "xmlBaseFile" (if any)
  • utils: an instance of MyfacesUtils that provides static helper methods
  • and whatever (name,value) pairs were configured via the "params" property of this mojo.

Mojo Attributes:

  • Requires a Maven 2.0 project to execute.
  • Requires dependency resolution of artifacts in scope: compile
  • Automatically executes within the lifecycle phase: generate-sources

Optional Parameters

Name Type Description
buildDirectory File Defines the directory where the metadata file (META-INF/myfaces-metadata.xml) is loaded, and the generated file named by xmlFile parameter is created.
metadataFile String Name of the file from which the metadata model passed to the template will be read. This file is typically generated by an earlier execution of the BuildMetaDataMojo goal for the same maven project.
modelIds List A list of metadata model ids.

If not defined, then this defaults to a list containing just one string whose value is the same as the current maven project's artifactId.

The complete metadata model is passed to the velocity template. This contains data about not just the model items defined in the calling project, but also about items imported from other projects. Each item in the model is labelled with a "model id" indicating which project it was defined by.

This list of model ids is also passed to the template. The template can then use that data to select the relevant items from the full model.

outputDirectory File Defines the directory where the resource will be output.
params Map A map of (name, value) pairs to be made available as Velocity variables for the executed template to access.
templateFile String Specifies the Velocity template file to be executed.
templateSourceDirectory File The base directory used when resolving references to external files from velocity #include and #parse commands within the executed template.
xmlBaseFile File When defined, specifies an xml file whose top-level elements are to be copied directly into the created file.

This allows a hand-written file to be created containing data that cannot be automatically generated. All content beneath the root element of the specified file (but not the root element itself) is placed into a Velocity variable named "baseContent" that the template can reference.

The template can do whatever it wants with this variable, but it is expected that the template will simply output this immediately after writing the root element of the output xml file. file.

Note that any attributes or namespaces defined on the root element of the xmlBaseFile are ignored.

xmlFile String Specifies the name of the output file to be created.

Parameter Details

buildDirectory

Defines the directory where the metadata file (META-INF/myfaces-metadata.xml) is loaded, and the generated file named by xmlFile parameter is created.

  • Type: java.io.File
  • Required: No
  • Expression: ${project.build.directory}/generated-resources/myfaces-builder-plugin

metadataFile

Name of the file from which the metadata model passed to the template will be read. This file is typically generated by an earlier execution of the BuildMetaDataMojo goal for the same maven project.

  • Type: java.lang.String
  • Required: No

modelIds

A list of metadata model ids.

If not defined, then this defaults to a list containing just one string whose value is the same as the current maven project's artifactId.

The complete metadata model is passed to the velocity template. This contains data about not just the model items defined in the calling project, but also about items imported from other projects. Each item in the model is labelled with a "model id" indicating which project it was defined by.

This list of model ids is also passed to the template. The template can then use that data to select the relevant items from the full model.

  • Type: java.util.List
  • Required: No

outputDirectory

Defines the directory where the resource will be output.

  • Type: java.io.File
  • Required: No
  • Expression: ${project.build.directory}/generated-resources/myfaces-builder-plugin

params

A map of (name, value) pairs to be made available as Velocity variables for the executed template to access.

  • Type: java.util.Map
  • Required: No

templateFile

Specifies the Velocity template file to be executed.

  • Type: java.lang.String
  • Required: No
  • Expression: faces-config11.vm

templateSourceDirectory

The base directory used when resolving references to external files from velocity #include and #parse commands within the executed template.

  • Type: java.io.File
  • Required: No
  • Expression: src/main/resources/META-INF

xmlBaseFile

When defined, specifies an xml file whose top-level elements are to be copied directly into the created file.

This allows a hand-written file to be created containing data that cannot be automatically generated. All content beneath the root element of the specified file (but not the root element itself) is placed into a Velocity variable named "baseContent" that the template can reference.

The template can do whatever it wants with this variable, but it is expected that the template will simply output this immediately after writing the root element of the output xml file. file.

Note that any attributes or namespaces defined on the root element of the xmlBaseFile are ignored.

  • Type: java.io.File
  • Required: No
  • Expression: src/main/conf/META-INF/faces-config-base.xml

xmlFile

Specifies the name of the output file to be created.

  • Type: java.lang.String
  • Required: No