Getting Started

This artifact contains a collection of Velocity tools that are used by the Sentry Maven Skin.

This artifact must be loaded as a dependency by the Maven Site plugin, as below:

<plugin>
  <artifactId>maven-site-plugin</artifactId>
  <dependencies>
    <dependency>
      <groupId>org.sentrysoftware.maven</groupId>
      <artifactId>maven-skin-tools</artifactId>
      <version>1.3.00</version>
    </dependency>
  </dependencies>
</plugin>

This allows the Maven Skin and Velocity-processed pages in a Maven Site to invoke the below Velocity tools:

Tool Description Javadoc
$htmlTool To manipulate HTML documents or fragments HtmlTool
$imageTool To manipulate images ImageTool
$indexTool To create search indexes IndexTool

The above tools are designed to be used only in the Velocity template of a Maven Site Skin as in the example below:

#set($bodyElement = $htmlTool.parseContent($bodyContent))
#set($bodyElement = $imageTool.explicitImageSize($bodyElement, "img", ${project.reporting.outputDirectory}, $currentFileName))
<html>
<body>
$bodyElement.html()
</body>
</html>

Additionally, we allow the use of these standard Velocity tools in the Velocity-processed pages (e.g. in src/site/markdown/*.md.vm):

Tool Description Javadoc
$collection Tool gathering several collection utilities CollectionTool
$json Tool for JSON parsing and rendering JsonTool
$log Tool to trigger logs from withing templates LogTool

Example:

#set( $repoList = $json.fetch("https://api.github.com/orgs/sentrysoftware/repos") )
#if( $repoList && $repoList.size() > 0 )
| Repository | Description |
|------------|-------------|
#foreach ($repo in $repoList.iterator() )
| $repo.name | $!repo.description |
#end
#else
$log.error("Could not fetch repositories")
*No repositories.*
#end

No results.