| <!DOCTYPE html> |
| <!-- |
| | Generated by Apache Maven Doxia Site Renderer 1.8.1 at 2019-12-09 |
| | 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="20191209" /> |
| <meta http-equiv="Content-Language" content="en" /> |
| <title>Apache Sling HTL Maven Plugin – 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: 2019-12-09<span class="divider">|</span> |
| </li> |
| <li id="projectVersion">Version: 1.3.2-1.4.0</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> |
| <div> |
| <pre class="source">mvn org.apache.sling:htl-maven-plugin:validate |
| </pre></div></div> |
| |
| <p>This assumes you’ve configured the <tt>${project.build.sourceDirectory}</tt> setting.</p> |
| <p>The command can be simplified to</p> |
| |
| <div> |
| <div> |
| <pre class="source">mvn htl:validate |
| </pre></div></div> |
| |
| <p>if your Maven user settings file provides the following configuration</p> |
| |
| <div> |
| <div> |
| <pre class="source"><pluginGroups> |
| <pluginGroup>org.apache.sling</pluginGroup> |
| </pluginGroups> |
| </pre></div></div> |
| </div> |
| <div class="section"> |
| <h3><a name="Configuring_the_HTL_Maven_Plugin"></a>Configuring the HTL Maven Plugin</h3> |
| |
| <div> |
| <div> |
| <pre class="source"><project> |
| ... |
| <build> |
| <pluginManagement> |
| <plugin> |
| <groupId>org.apache.sling</groupId> |
| <artifactId>htl-maven-plugin</artifactId> |
| <version>1.3.2-1.4.0/version> |
| <configuration> |
| <!-- put your configurations here --> |
| </configuration> |
| <executions> |
| <execution> |
| <goals> |
| <goal>validate</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| </pluginManagement> |
| </build> |
| ... |
| </project> |
| </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’s possible to generate Java classes from the project’s HTL scripts. This is useful when you want to identify your script’s Java dependencies. To do this the following configuration should be applied:</p> |
| |
| <div> |
| <div> |
| <pre class="source"><project> |
| ... |
| <build> |
| <pluginManagement> |
| <plugin> |
| <groupId>org.apache.sling</groupId> |
| <artifactId>htl-maven-plugin</artifactId> |
| <version>1.3.2-1.4.0/version> |
| <configuration> |
| <!-- put your configurations here --> |
| <failOnWarnings>true</failOnWarnings> |
| <generateJavaClasses>true</generateJavaClasses> |
| </configuration> |
| <executions> |
| <execution> |
| <id>validate-scripts</id> |
| <goals> |
| <goal>validate</goal> |
| </goals> |
| <phase>generate-sources</phase> |
| </execution> |
| </executions> |
| </plugin> |
| </pluginManagement> |
| </build> |
| ... |
| </project> |
| </pre></div></div> |
| |
| <p>Additionally, the following dependencies are required as part of your project’s dependencies list:</p> |
| |
| <div> |
| <div> |
| <pre class="source"><!-- HTL dependencies needed for the HTL Maven Plugin source code generation --> |
| <dependency> |
| <groupId>org.apache.sling</groupId> |
| <artifactId>org.apache.sling.scripting.sightly.compiler</artifactId> |
| <!-- version 1.0.14 or higher --> |
| <version>1.0.14</version> |
| <scope>provided</scope> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.sling</groupId> |
| <artifactId>org.apache.sling.scripting.sightly.compiler.java</artifactId> |
| <!-- version 1.0.16 or higher --> |
| <version>1.0.16</version> |
| <scope>provided</scope> |
| </dependency> |
| </pre></div></div> |
| |
| <p>Starting with version 1.2.2 of the <tt>htl-maven-plugin</tt>, only the following dependency is needed as part of your project’s dependency list:</p> |
| |
| <div> |
| <div> |
| <pre class="source"><!-- HTL dependencies needed for the HTL Maven Plugin source code generation --> |
| <dependency> |
| <groupId>org.apache.sling</groupId> |
| <artifactId>org.apache.sling.scripting.sightly.runtime</artifactId> |
| <version>$context.get("sightly.runtime.version")</version> |
| <scope>provided</scope> |
| </dependency> |
| </pre></div></div></div></div> |
| </div> |
| </div> |
| </div> |
| <hr/> |
| <footer> |
| <div class="container-fluid"> |
| <div class="row-fluid"> |
| <p>Copyright ©2007–2019 |
| <a href="https://www.apache.org/">The Apache Software Foundation</a>. |
| All rights reserved.</p> |
| </div> |
| </div> |
| </footer> |
| </body> |
| </html> |