AEM Developer Cheat Sheet

ChatGPT generated image of man riding Adobe logo

Just a little something I wish I had when I first started working with AEM. Adobe Experience Manager can feel like a real chicken-and-egg situation—Adobe doesn’t provide an easy way to set up AEM instances for experimentation, so you’re kind of forced to learn on the job. That’s a tough spot to be in when a company is paying you to already know how to do AEM work.

Common URLs

PurposePath
AEM Author Loginhttp://localhost:4502
AEM Publish Instancehttp://localhost:4503
CRXDE Lite/crx/de
Felix Console (OSGi configs/bundles)/system/console/configMgr
Sling Models console/system/console/adapters
Dispatcher Flush Agent/etc/replication/agents.author/dispatcher
Package Manager/crx/packmgr/index.jsp
Useradmin/useradmin
Sites Authoring/sites.html/content
Template Editor/libs/wcm/core/content/sites/templates.html/conf

Useful File System Paths (JCR)

PurposeJCR Path
Page Content/content/your-site/...
Components/apps/your-project/components/...
Templates/conf/your-project/settings/wcm/templates/...
Editable Template Policies/conf/your-project/settings/wcm/policies/...
Core Components (Do not modify!)/libs/core/components/...
Clientlibs/apps/your-project/clientlibs/...
Designs (for legacy static templates)/etc/designs/

Maven Commands

mvn clean install
mvn clean install -PautoInstallPackage
mvn clean install -PautoInstallPackage -pl ui.apps
mvn clean install -PautoInstallBundle -pl core

CRX Package Manager (Curl)

curl -u admin:admin -F file=@"my-package.zip" -F name=my-package -F force=true -F install=true http://localhost:4502/crx/packmgr/service.jsp

HTL (Sightly) Snippets

${myModel.title}
<ul data-sly-list.item="${myModel.items}">
  <li>${item.name}</li>
</ul>
<div data-sly-resource="${ 'mycomponent' @ resourceType='myproject/components/foo' }"></div>
<div data-sly-test="${myModel.showThing}">Shown if true</div>

Sling Models (Java)

@Model(adaptables = Resource.class)
public class ExampleModel {
    @Inject private String title;
    @ValueMapValue private String subtitle;
    @Default(values = "Default text") private String footer;
    public String getTitle() { return title; }
}

Registering an OSGi Servlet

@Component(service = Servlet.class,
           property = {
             "sling.servlet.methods=GET",
             "sling.servlet.paths=/bin/myendpoint"
           })
public class MyServlet extends SlingSafeMethodsServlet {
    @Override
    protected void doGet(SlingHttpServletRequest req, SlingHttpServletResponse resp) throws IOException {
        resp.getWriter().write("Hello from servlet!");
    }
}

Dispatcher Caching Quick Tips

Troubleshooting Tips

SymptomTip
Component not renderingCheck resourceType and Sling resolution
Model not workingConfirm @Model and Sling exporter
Bundle not activeCheck /system/console/bundles
No logs from codeUse logger, check error.log
Dispatcher not updatingClear cache or flush manually

Log Statements (Java)

private static final Logger log = LoggerFactory.getLogger(MyModel.class);
log.info("Something happened");
log.debug("Variable value: {}", value);
log.error("Something went wrong", e);

Common Component File Structure

/apps/your-project/components/card/
  ├── card.html
  ├── _cq_dialog/.content.xml
  ├── _cq_editConfig.xml
  └── cq:template

Editable Template Setup

  1. Template type: /apps/your-project/templates
  2. Templates: /conf/your-project/settings/wcm/templates
  3. Policies: /conf/your-project/settings/wcm/policies