[ https://issues.apache.org/jira/browse/SLING-7155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16210402#comment-16210402 ]
Tobias Bocanegra commented on SLING-7155: ----------------------------------------- [~radu.cotescu] cool, thanks! it has one flaw, though: the use classes are not used as class references in the java but via reflection, which causes them to be removed from the compiled class file. eg: html script: {code} <form data-sly-use.container="com.adobe.cq.wcm.core.components.models.form.Container" data-sly-use.grid="com.day.cq.wcm.foundation.model.responsivegrid.ResponsiveGrid" method="${container.method}" action="${container.action}" id="${container.id}" name="${container.name}" enctype="${container.enctype}" class="cmp-form ${grid.cssClass}"> {code} generated java: {code} import com.day.cq.wcm.foundation.model.responsivegrid.ResponsiveGrid; import com.adobe.cq.wcm.core.components.models.form.Container; ... public final class container_html extends RenderUnit { ... _global_container = renderContext.call("use", "com.adobe.cq.wcm.core.components.models.form.Container", obj()); _global_grid = renderContext.call("use", "com.day.cq.wcm.foundation.model.responsivegrid.ResponsiveGrid", obj()); {code} but the class {{com.adobe.cq.wcm.core.components.models.form.Container}} is never referenced as such in the code, so it is not visible in the class file and not detected as dependency by the class scanner. ideally, the htl compiler should do something like: {code} _global_container = renderContext.call("use", com.adobe.cq.wcm.core.components.models.form.Container.class.getName(), obj()); {code} or the {{renderContext}} also offers a signature with the class instead of just the string, eg: {code} _global_container = renderContext.call("use", com.adobe.cq.wcm.core.components.models.form.Container.class, obj()); {code} WDYT? > htl-maven-plugin: Add option to precompile the HTL scripts > ---------------------------------------------------------- > > Key: SLING-7155 > URL: https://issues.apache.org/jira/browse/SLING-7155 > Project: Sling > Issue Type: Improvement > Components: Maven Plugins and Archetypes > Affects Versions: HTL Maven Plugin 1.0.8 > Reporter: Tobias Bocanegra > Assignee: Radu Cotescu > > It would be cool if the HTL Maven Plugin could precompile the HTL scripts, > similar to the JSPC plugin. > This would have the following advantages: > * the project needs to specify all the (compile time) dependencies the > scripts needs; this makes the project more robust and changes in dependencies > are easier detectable; > * the compiled classes could be used as source to generate the import-package > statements for the {{filevault-package-maven-plugin}}. -- This message was sent by Atlassian JIRA (v6.4.14#64029)