HTL-Maven plugin is not working in AEM 6.2

1.3k views Asked by At

I want to use htl-maven-plugin to validate HTL syntax. I am using the plugin shown below:

         <plugin>
                <groupId>org.apache.sling</groupId>
                <artifactId>htl-maven-plugin</artifactId>
                <version>1.0.6</version>
                <executions>
                    <execution>
                        <id>validate-scripts</id>
                        <goals>
                            <goal>validate</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                </executions>
                <configuration>
                    <sourceDirectory>ui.apps/src/main/content/jcr_root</sourceDirectory>
                    <failOnWarnings>true</failOnWarnings>
                    <includes>**/*.html</includes>

                </configuration>
            </plugin>

But it's not validating my HTL part and make the build success. Please help!!!

1

There are 1 answers

2
Vlad On

Most probably your sourceDirectory is not properly configured. Are your sources really in ui.apps/src/main/content/jcr_root? If not, please update the configuration!

If your project is structured as:

  • reactor
    • ui.apps
      • src/main/content/jcr_root/apps/..
      • pom.xml
    • ui.content
    • ..

The sourceDirectory in ui.apps/pom.xml should be configured to src/main/content/jcr_root (relative to ui.apps module pom)

Also, running mvn htl:validate from the command line in ui.apps module will give you a bit more information about what is happening. You should see either:

  • [INFO] Source directory does not exist, skipping. - source directory is not configured properly.
  • [INFO] Processed .. files in .. milliseconds - source is configured, files were processed

For more documentation please also refer to http://sling.apache.org/components/htl-maven-plugin/plugin-info.html