Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Error: cannot find symbol only on ui.apps

Avatar

Level 1

Hi,

 

I just created my first java model (based on another that works, basically a copy) that has blocked the ability to deploy only ui.apps. If I deploy the whole project, it works just fine, otherwise it brings the cannot find symbol error with the class name I assigned. The model and impl filename appear in the web console here: Adobe Experience Manager Web Console - Sling Adapters and the impl is registered in Bundles. If I change the data-sly-use to an already existing model, it works fine as well.

 

To deploy I use the commands listed here. I rarely use the aem sync extension, however it works, even with this particular error.

 

com.XXX.core.models.PlatinumHeader
com.XXX.core.models.impl.v1.PlatinumHeaderImpl
<sly data-sly-use.header="com.xxx.core.models.PlatinumHeader"/>

 

 

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.14.0:compile (default-compile) on project aem-xxx-project.ui.apps: Compilation failure
[ERROR] /C:/../ui.apps/target/generated-sources/htl/org/apache/sling/scripting/sightly/apps/xxx/components/platinumheader/v1/platinumheader/platinumheader__002e__html.java:[41,86] cannot find symbol
[ERROR]   symbol:   class PlatinumHeader
[ERROR]   location: package com.xxx.core.models

 

Thanks,

3 Replies

Avatar

Community Advisor

@FabianAl1 how do you refer your core bundle in ui.apps? Basically you added Java class in core bundle project but your ui.apps project not able refer to your latest build core bundle. You either need to build your core bundle project first and refer that version in your ui.apps project as dependency or build whole project at once.

Avatar

Level 1

Hi @Shashi_Mulugu, I checked, and it is being referred as @Karishma_begumSh said on the ui.apps/pom.xml with the same dependency for the core. Building the whole project at once with mvn clean install -PautoInstallPackage works and changes can be seen locally, but when I try to deploy front-end changes and compile only the ui.apps folder, it fails with the cannot find symbol error message. I try to deploy from ui.apps directly because I find it faster.

 

For the core only build I use mvn clean install -PautoInstallBundle, then on ui.apps I use mvn clean install -PautoInstallPackage.

Avatar

Level 5

Hi @FabianAl1 

HTL compilation in AEM occurs at build time in the ui.apps module.

  • ui.apps module does not automatically include core classes unless declared as a dependency.
  • Your PlatinumHeader class is in core, but ui.apps does not see it at compile time unless the Maven dependency is configured.
  • That’s why using an existing model (already in the classpath) works, but your new one doesn’t.

Basically:

  • ui.apps → contains HTL and front-end code
  • core → contains Java classes (Sling Models)
  • HTL compilation requires the core classes on the classpath of ui.apps during the build

In ui.apps/pom.xml add dependecny in your core module

<dependency>
    <groupId>com.xxx</groupId>
    <artifactId>aem-xxx-project.core</artifactId>
    <version>${project.version}</version>
    <scope>provided</scope>
</dependency>

Make a build after this mvn clean install -PautoInstallPackage.

 

After this, ui.apps can compile HTL referencing the new model because the compiler can see PlatinumHeader.

 

Hope this helpful 🙂

 

Regards,

Karishma.