Plexus Velocity Component

A component which provides Apache Velocity templating engine integration.

Typical use

A typical use:

VelocityContext context = new VelocityContext();
VelocityComponent velocityComponent =  (DefaultVelocityComponent) lookup( VelocityComponent.ROLE );
Template template = velocityComponent.getEngine().getTemplate( "path to your template" );
StringWriter writer = new StringWriter();
template.merge( context, writer );

Typical Configuration

Plexus Velocity Component comes with a default configuration: it is expected to be customized to match local specific need. This is done by hand writing a META-INF/plexus/components.xml Plexus descriptor.

A typical component configuration:

    <component>
      <role>org.codehaus.plexus.velocity.VelocityComponent</role>
      <implementation>org.codehaus.plexus.velocity.DefaultVelocityComponent</implementation>
      <configuration>
        <properties>
          <property>
            <name>resource.loader</name>
            <value>classpath</value>
          </property>
          <property>
            <name>classpath.resource.loader.class</name>
            <value>org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader</value>
          </property>
        </properties>
      </configuration>
    </component>

See Velocity Configuration Keys and Values reference documentation for details on available configurations.