velocitymaven-site-plugin

How to fail Velocity template processing with tracable message


Having:

How to validate the object (#if) and fail (stop further processing) in a way that is easily tracable to the place of failure (like throwing exception in Java).

I am looking for something like this:

#if ( ! $context.treasureMap.containsKey('gold'))
  #fail('no golden treasure here')
#end

Background

I am writing a maven site page. The velocity context is injected by maven and contains POM information. I want to test existence of some information from effective pom. When the information is not available, I want to fail.

Requirements

Tried


Solution

  • The behavior was fixed in maven-doxia-sitetools:1.8.1 for my use case (see DOXIASITETOOLS-179).