This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch SLING-10696-phase-generate-sources
in repository https://gitbox.apache.org/repos/asf/sling-htl-maven-plugin.git

commit 95529cbbf3b5abb085edc63f5a7e8721eb437fb1
Author: Konrad Windszus <[email protected]>
AuthorDate: Mon Aug 2 14:32:19 2021 +0200

    SLING-10696 switch to phase "generate-sources"
    
    add debug log information per processed HTL script
    clarify description of validate mojo
---
 src/main/java/org/apache/sling/maven/htl/ValidateMojo.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/maven/htl/ValidateMojo.java 
b/src/main/java/org/apache/sling/maven/htl/ValidateMojo.java
index 02f1f8a..1378f29 100644
--- a/src/main/java/org/apache/sling/maven/htl/ValidateMojo.java
+++ b/src/main/java/org/apache/sling/maven/htl/ValidateMojo.java
@@ -53,11 +53,11 @@ import org.codehaus.plexus.util.Scanner;
 import org.sonatype.plexus.build.incremental.BuildContext;
 
 /**
- * Validates HTL scripts.
+ * Validates HTL scripts and optionally transpiles them to Java classes.
  */
 @Mojo(
         name = "validate",
-        defaultPhase = LifecyclePhase.COMPILE,
+        defaultPhase = LifecyclePhase.GENERATE_SOURCES,
         threadSafe = true
 )
 public class ValidateMojo extends AbstractMojo {
@@ -291,6 +291,7 @@ public class ValidateMojo extends AbstractMojo {
             FileUtils.forceMkdirParent(generatedClassFile);
             IOUtils.write(javaSourceCode, new 
FileOutputStream(generatedClassFile), StandardCharsets.UTF_8);
             compilationUnit.dispose();
+            getLog().debug(String.format("Transpiled HTL '%s' to Java class 
'%s'", script, generatedClassFile));
         }
         return compilationResult;
     }
@@ -301,6 +302,7 @@ public class ValidateMojo extends AbstractMojo {
             ScriptCompilationUnit scriptCompilationUnit = new 
ScriptCompilationUnit(sourceDirectory, script);
             compilationResult.put(script, 
compiler.compile(scriptCompilationUnit));
             scriptCompilationUnit.dispose();
+            getLog().debug(String.format("Compiled HTL script '%s'", script));
         }
         return compilationResult;
     }

Reply via email to