blob: 9e256a827dde59f1fc596594c3597167e79cf8dd [file] [log] [blame]
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.7.1 at 2018-02-01
| Rendered using Apache Maven Fluido Skin 1.6
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="Date-Revision-yyyymmdd" content="20180201" />
<meta http-equiv="Content-Language" content="en" />
<title>Apache Sling HTL Maven Plugin &#x2013; Usage</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.6.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script type="text/javascript" src="./js/apache-maven-fluido-1.6.min.js"></script>
</head>
<body class="topBarDisabled">
<div class="container-fluid">
<div id="banner">
<div class="pull-left"><div id="bannerLeft"><h2>Apache Sling HTL Maven Plugin</h2>
</div>
</div>
<div class="pull-right"></div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li id="publishDate">Last Published: 2018-02-01<span class="divider">|</span>
</li>
<li id="projectVersion">Version: 1.1.4-1.3.1</li>
</ul>
</div>
<div class="row-fluid">
<div id="leftColumn" class="span2">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Overview</li>
<li><a href="index.html" title="Introduction"><span class="none"></span>Introduction</a> </li>
<li><a href="plugin-info.html" title="Goals"><span class="none"></span>Goals</a> </li>
<li class="active"><a href="#"><span class="none"></span>Usage</a>
</li>
<li class="nav-header">Project Documentation</li>
<li><a href="project-info.html" title="Project Information"><span class="icon-chevron-right"></span>Project Information</a> </li>
<li><a href="project-reports.html" title="Project Reports"><span class="icon-chevron-right"></span>Project Reports</a> </li>
</ul>
<hr />
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a>
</div>
</div>
</div>
<div id="bodyColumn" class="span10" >
<div class="section">
<h2><a name="Usage"></a>Usage</h2>
<div class="section">
<h3><a name="Validating_your_HTL_Scripts"></a>Validating your HTL Scripts</h3>
<p>To validate your HTL Scripts you can run the following command:</p>
<div class="source">
<div class="source"><pre class="prettyprint linenums">mvn org.apache.sling:htl-maven-plugin:validate
</pre></div></div>
<p>This assumes you&#x2019;ve configured the <tt>${project.build.sourceDirectory}</tt> setting.</p>
<p>The command can be simplified to</p>
<div class="source">
<div class="source"><pre class="prettyprint linenums">mvn htl:validate
</pre></div></div>
<p>if your Maven user settings file provides the following configuration</p>
<div class="source">
<div class="source"><pre class="prettyprint linenums">&lt;pluginGroups&gt;
&lt;pluginGroup&gt;org.apache.sling&lt;/pluginGroup&gt;
&lt;/pluginGroups&gt;
</pre></div></div></div>
<div class="section">
<h3><a name="Configuring_the_HTL_Maven_Plugin"></a>Configuring the HTL Maven Plugin</h3>
<div class="source">
<div class="source"><pre class="prettyprint linenums">&lt;project&gt;
...
&lt;build&gt;
&lt;pluginManagement&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.sling&lt;/groupId&gt;
&lt;artifactId&gt;htl-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;1.1.4-1.3.1/version&gt;
&lt;configuration&gt;
&lt;!-- put your configurations here --&gt;
&lt;/configuration&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;goals&gt;
&lt;goal&gt;validate&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;
&lt;/pluginManagement&gt;
&lt;/build&gt;
...
&lt;/project&gt;
</pre></div></div></div>
<div class="section">
<h3><a name="Generating_Java_classes_from_your_HTL_scripts"></a>Generating Java classes from your HTL scripts</h3>
<p>Since version 1.1.0 it&#x2019;s possible to generate Java classes from the project&#x2019;s HTL scripts. This is useful when you want to identify your script&#x2019;s Java dependencies. To do this the following configuration should be applied:</p>
<div class="source">
<div class="source"><pre class="prettyprint linenums">&lt;project&gt;
...
&lt;build&gt;
&lt;pluginManagement&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.sling&lt;/groupId&gt;
&lt;artifactId&gt;htl-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;1.1.4-1.3.1/version&gt;
&lt;configuration&gt;
&lt;!-- put your configurations here --&gt;
&lt;failOnWarnings&gt;true&lt;/failOnWarnings&gt;
&lt;generateJavaClasses&gt;true&lt;/generateJavaClasses&gt;
&lt;/configuration&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;id&gt;validate-scripts&lt;/id&gt;
&lt;goals&gt;
&lt;goal&gt;validate&lt;/goal&gt;
&lt;/goals&gt;
&lt;phase&gt;generate-sources&lt;/phase&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;
&lt;/pluginManagement&gt;
&lt;/build&gt;
...
&lt;/project&gt;
</pre></div></div></div></div>
</div>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row-fluid">
<p>Copyright &copy;2007&#x2013;2018
<a href="https://www.apache.org/">The Apache Software Foundation</a>.
All rights reserved.</p>
</div>
</div>
</footer>
</body>
</html>