AEM cloud build Issue about htl-maven-plugin | Community
Skip to main content
Level 2
August 4, 2024
Solved

AEM cloud build Issue about htl-maven-plugin

  • August 4, 2024
  • 2 replies
  • 1629 views

Hi there,
I am facing  a build failure after using   "mvn -PautoInstallSinglePackage clean install"
Here's my version details
Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Maven home: C:\Program Files\Maven\apache-maven-3.8.8
Java version: 11.0.23, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-11
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

[ERROR] Failed to execute goal org.apache.sling:htl-maven-plugin:2.0.2-1.4.0:validate (validate-htl-scripts) on project aem-jupiteram-project.ui.apps: Execution validate-htl-scripts of goal org.apache.sling:htl-maven-plugin:2.0.2-1.4.0:validate failed: A required class was missing while executing org.apache.sling:htl-maven-plugin:2.0.2-1.4.0:validate: org/apache/sling/scripting/sightly/java/compiler/JavaImportsAnalyzer
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.sling:htl-maven-plugin:2.0.2-1.4.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy


Could you please give me any suggestions about fixing this issue?
I uninstall and reinstalled everything, but it did not help me to fix this issue

Thanks in advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Raja_Reddy

Hi @akurtulush 
it seems that the htl-maven-plugin is missing a required class org/apache/sling/scripting/sightly/java/compiler/JavaImportsAnalyzer. This could be due to a compatibility issue or a corrupted installation.
1.Clean the Maven repository: Sometimes, corrupted dependencies in the local Maven repository can cause build failures. You can try deleting the contents of the .m2/repository directory in your user home directory and then re-run the build command.
2.Check for conflicting dependencies: It's possible that there are conflicting dependencies in your project's pom.xml file. You can use the Maven Dependency Plugin to analyze the dependency tree and identify any conflicts.
try this command mvn dependency:tree.
3.Java version you are using is compatible with the Maven and the plugin. In your case, Java 11 seems to be installed, which should be compatible. However, you can double-check if there are any specific Java version requirements for the htl-maven-plugin.

2 replies

Raja_Reddy
Community Advisor
Raja_ReddyCommunity AdvisorAccepted solution
Community Advisor
August 5, 2024

Hi @akurtulush 
it seems that the htl-maven-plugin is missing a required class org/apache/sling/scripting/sightly/java/compiler/JavaImportsAnalyzer. This could be due to a compatibility issue or a corrupted installation.
1.Clean the Maven repository: Sometimes, corrupted dependencies in the local Maven repository can cause build failures. You can try deleting the contents of the .m2/repository directory in your user home directory and then re-run the build command.
2.Check for conflicting dependencies: It's possible that there are conflicting dependencies in your project's pom.xml file. You can use the Maven Dependency Plugin to analyze the dependency tree and identify any conflicts.
try this command mvn dependency:tree.
3.Java version you are using is compatible with the Maven and the plugin. In your case, Java 11 seems to be installed, which should be compatible. However, you can double-check if there are any specific Java version requirements for the htl-maven-plugin.

Level 2
August 5, 2024

Hi Raja,
Thanks for your suggestions.
Deleted my .m2/repository and rebuild project again. That worked for me

aanchal-sikka
Community Advisor
Community Advisor
August 5, 2024

@akurtulush 

 

It seems your HTL is importing a java class (may be a Sling Model) which is not available.

  • Please build the core bundle first
  • Assure that these imports are available. Best to check via the bundle information in /system/console/bundles/<your bundle>
  • Build the apps module which is causing issue.

It should be resolved now. You can even try after building the entire Project once, if apps is built after core & the import is available, the complete build should go through.

Aanchal Sikka
Level 2
August 5, 2024

Hi aanchal_sikka,
Thanks for your all suggestions.