| #set($h1 = '#') |
| #set($h2 = '##') |
| #set($h3 = '###') |
| #set($h4 = '####') |
| |
| |
| $h2 Usage |
| |
| $h3 Validating your HTL Scripts |
| |
| To validate your HTL Scripts you can run the following command: |
| |
| ``` |
| mvn org.apache.sling:htl-maven-plugin:validate |
| ``` |
| |
| This assumes you've configured the `\${project.build.sourceDirectory}` setting. |
| |
| The command can be simplified to |
| |
| ``` |
| mvn htl:validate |
| ``` |
| |
| if your Maven user settings file provides the following configuration |
| |
| ``` |
| <pluginGroups> |
| <pluginGroup>org.apache.sling</pluginGroup> |
| </pluginGroups> |
| ``` |
| |
| $h3 Configuring the HTL Maven Plugin |
| |
| ``` |
| <project> |
| ... |
| <build> |
| <pluginManagement> |
| <plugin> |
| <groupId>org.apache.sling</groupId> |
| <artifactId>htl-maven-plugin</artifactId> |
| <version>${project.version}/version> |
| <configuration> |
| <!-- put your configurations here --> |
| </configuration> |
| <executions> |
| <execution> |
| <goals> |
| <goal>validate</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| </pluginManagement> |
| </build> |
| ... |
| </project> |
| ``` |
| |
| $h3 Generating Java classes from your HTL scripts |
| |
| 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: |
| |
| ``` |
| <project> |
| ... |
| <build> |
| <pluginManagement> |
| <plugin> |
| <groupId>org.apache.sling</groupId> |
| <artifactId>htl-maven-plugin</artifactId> |
| <version>${project.version}/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> |
| ``` |