Skip to content

About

Provides a ready-configured Apache Velocity engine as an injectable component

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

3 watching

Forks

Latest commit

 

History

229 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plexus Velocity

Maven Central GitHub CI Reproducible Builds License

A ready-configured Apache Velocity engine as an injectable component, so a plugin can render a template without setting up Velocity itself.

Status

Maintained, quietly. It is a thin wrapper over Velocity; most changes here are Velocity upgrades.

Using it

<dependency>
  <groupId>org.codehaus.plexus</groupId>
  <artifactId>plexus-velocity</artifactId>
</dependency>

Check the badge above for the current version.

@Inject
VelocityComponent velocityComponent;

VelocityContext context = new VelocityContext();
Template template = velocityComponent.getEngine().getTemplate( "path/to/template.vm" );
StringWriter writer = new StringWriter();
template.merge( context, writer );

The engine starts with these defaults, which a VelocityComponentConfigurator can change or replace:

  • templates are looked up on the classpath first, then as files (the file loader path is empty, so a relative name resolves against the working directory and an absolute path works as is);
  • #include and #parse resolve relative to the including template (IncludeRelativePath);
  • invalid references are not logged, and neither is each template that is found;
  • a #macro defined inline replaces a global one with the same name (velocimacro.inline.replace_global);
  • parser.space_gobbling is bc.

The default configuration is meant to be customised: provide a VelocityComponentConfigurator implementation, whose configure(Properties) receives these defaults before the engine starts, and it will be picked up. It is optional. The engine is created once and shared. See the Velocity configuration reference for what can be set.

Requirements

Java 8 or later. Building the project needs Maven 3.9.0 or later.

Documentation

Contributing

Conventions for contributors and agents are in AGENTS.md; see also CONTRIBUTING.md. In short: mvn verify builds, and run mvn spotless:apply before pushing or CI will fail on formatting.

Please report security vulnerabilities privately — see SECURITY.md, not a public issue.

About

Provides a ready-configured Apache Velocity engine as an injectable component

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

3 watching

Forks

Releases

Used by

Contributors

Languages