Like an idiot it took me until today to check out about:flags in MS Edge. Anyways, under Developer settings I found that 'Allow localhost loopback' is enabled by default, but the description states 'this might put your device at risk'. Add the adobe-public profile to your Maven settings.xml file in order to automatically add repo.adobe.com to the maven build process. Create a file named settings.xml at /.m2/settings.xml if it doesn’t exist already. Add the adobe-public profile to the settings.xml file based on the instructions here. A sample settings.xml is listed below. Block Adobe Photoshop CC activation outbound link using windows host file or firewall is a common question for everyone. I am not a professional Graphic Designer, but sometimes I like to play with Adobe tools like Photoshop CC. As I dont use it for professional works, I decided to not purchase, instead just use the Trial version.
# copyright (c) 1993-2009 microsoft corp. |
# |
# this is a sample hosts file used by microsoft tcp/ip for windows. |
# |
# this file contains the mappings of ip addresses to host names. each |
# entry should be kept on an individual line. the ip address should |
# be placed in the first column followed by the corresponding host name. |
# the ip address and the host name should be separated by at least one |
# space. |
# |
# additionally, comments (such as these) may be inserted on individual |
# lines or following the machine name denoted by a '#' symbol. |
# |
# for example: |
# |
# 102.54.94.97 rhino.acme.com # source server |
# 38.25.63.10 x.acme.com # x client host |
# localhost name resolution is handled within dns itself. |
# 127.0.0.1 localhost |
# ::1 localhost |
127.0.0.1 localhost |
# |
# adobe activation block v2. |
# |
# for updates to the hosts check here: http://thepiratebay.org/user/thethingy |
# |
127.0.0.1 3dns.adobe.com 3dns-1.adobe.com 3dns-2.adobe.com 3dns-3.adobe.com 3dns-4.adobe.com activate.adobe.com activate-sea.adobe.com activate-sjc0.adobe.com activate.wip.adobe.com |
127.0.0.1 activate.wip1.adobe.com activate.wip2.adobe.com activate.wip3.adobe.com activate.wip4.adobe.com adobe-dns.adobe.com adobe-dns-1.adobe.com adobe-dns-2.adobe.com adobe-dns-3.adobe.com adobe-dns-4.adobe.com |
127.0.0.1 adobeereg.com practivate.adobe practivate.adobe.com practivate.adobe.newoa practivate.adobe.ntp practivate.adobe.ipp ereg.adobe.com ereg.wip.adobe.com ereg.wip1.adobe.com |
127.0.0.1 ereg.wip2.adobe.com ereg.wip3.adobe.com ereg.wip4.adobe.com hl2rcv.adobe.com wip.adobe.com wip1.adobe.com wip2.adobe.com wip3.adobe.com wip4.adobe.com |
127.0.0.1 www.adobeereg.com wwis-dubc1-vip60.adobe.com www.wip.adobe.com www.wip1.adobe.com |
127.0.0.1 www.wip2.adobe.com www.wip3.adobe.com www.wip4.adobe.com wwis-dubc1-vip60.adobe.com crl.verisign.net crl.verisign.net ood.opsource.net |
# |
# any other entries you had go here (new line no # no space); |
127.0.0.1 localhost |
Guide to setting up a local development for Adobe Experience Manager, AEM. Covers important topics of local installation, Apache Maven, integrated development environments and debugging/troubleshooting. Development with Eclipse IDE, CRXDE Lite, Visual Studio Code and IntelliJ are discussed.
Overview
Setting up a local development environment is the first step when developing for Adobe Experience Manager or AEM. Take the time to set up a quality development environment to increase your productivity and write better code, faster. We can break an AEM local development environment into 4 areas:
- Local AEM instances
- Apache Maven project
- Integrated Development Environments (IDE)
- Troubleshooting
Install local AEM Instances
When we refer to a local AEM instance, we are talking about a copy of Adobe Experience Manager that is running on a developer’s personal machine. All AEM development should start by writing and running code against a local AEM instance.
If you are new to AEM, there are two basic run modes can be installed: Author and Publish. The Authorrunmode is the environment that digital marketers will use to create and manage content. When developing most of the time you will be deploying code to an Author instance. This allows you to create new pages as well as add and configure components. AEM Sites is a WYSIWYG authoring CMS and therefore most of the CSS and JavaScript can be tested against an authoring instance.
It is also critical test code against a local Publish instance. The Publish instance is the AEM environment that visitors to your website will interact with. While the Publish instance is the same technology stack as the Author instance, there are some major distinctions with configurations and permissions. Code should always be tested against a local Publish instance before being promoted to higher level environments.
Steps
Ensure Java is installed.
- Prefer Java JDK 11 for AEM 6.5+
- Java JDK 8 for AEM versions prior to AEM 6.5
Get a copy of the AEM QuickStart Jar and a license.properties.
Create a folder structure on your computer like the following:
Rename the QuickStart JAR to aem-author-p4502.jar and place it beneath the
/author
directory. Add the license.properties file beneath the/author
directory.Make a copy of the QuickStart JAR, rename it to aem-publish-p4503.jar and place it beneath the
/publish
directory. Add a copy of the license.properties file beneath the/publish
directory.Double-click the aem-author-p4502.jar file to install the Author instance. This will start the author instance, running on port 4502 on the local computer.
Double-click the aem-publish-p4503.jar file to install the Publish instance. This will start the Publish instance, running on port 4503 on the local computer.
Depending on your development machine’s hardware it may be difficult to have both an Author and Publish instance running at the same time. Rarely do you need to run both simultaneously on a local setup.
For more information see Deploying and Maintaining an AEM instance.
Install Apache Maven
Apache Maven is a tool to manage the build and deploy procedure for Java-based projects. AEM is a Java-based platform and Maven is the standard way to manage code for an AEM project. When we say AEM Maven Project or just your AEM Project, we are referring to a Maven project that includes all of the custom code for your site.
All AEM projects should be built off the latest version of the AEM Project Archetype: https://github.com/Adobe-Marketing-Cloud/aem-project-archetype. The AEM Project Archetype will create a bootstrap of an AEM project with some sample code and content. The AEM Project Archetype also includes AEM WCM Core Components configured to be used on your project.
When starting a new project it is a best practice to use the latest version of the archetype. Keep in mind that there are multiple versions of the archetype and not all versions are compatible with earlier versions of AEM.
Steps
Download Apache Maven
Install Apache Maven and ensure that the installation has been added to your command-line
PATH
.- macOS users can install Maven using Homebrew
Verify that Maven is installed by opening a new command line terminal and executing the following:
Add the adobe-public profile to your Maven settings.xml file in order to automatically add repo.adobe.com to the maven build process.
Create a file named
settings.xml
at~/.m2/settings.xml
if it doesn’t exist already.Add the adobe-public profile to the
settings.xml
file based on the instructions here.A sample
settings.xml
is listed below. Note, the naming convention ofsettings.xml
and the placement beneath the user’s.m2
directory is important.Verify that the adobe-public profile is active by running the following command:
If you do not see the adobe-public it is an indication that the Adobe repo is not properly referenced in your
~/.m2/settings.xml
file. Please revisit the earlier steps and verify that the settings.xml file references the Adobe repo.
Set Up an Integrated Development Environment
An integrated development environment or IDE is an application that combines a text editor, syntax support and build-tools. Depending on the type of development you are doing, one IDE might be preferable over another. Regardless of the IDE, it will be important to be able to periodically push code to a local AEM instance in order to test it. It will also be important to occasionally pull configurations from a local AEM instance into your AEM project in order to persist to a source-control management system like Git.
Below are a few of the more popular IDEs that are used with AEM development with corresponding videos that show the integration with a local AEM instance.
Eclipse IDE
The Eclipse IDE is one of the more popular IDEs for Java development, in large part because it is open source and free! Adobe provides a plugin, AEM Developer Tools, for Eclipse to allow easier development with a nice GUI to synchronize code with a local AEM instance. The Eclipse IDE is recommended for developers new to AEM in large part because of the GUI support by AEM Developer Tools.
Installation and Setup
- Download and install the Eclipse IDE for Java EE Developers: https://www.eclipse.org
- Follow the instructions to install the AEM Developer Tools plugin: https://eclipse.adobe.com/aem/dev-tools/
- 00:30 - Import Maven Project
- 01:24 - Build and deploy source code with Maven
- 04:33 - Push code changes with AEM Developer Tool
- 10:55 - Pull code changes with AEM Developer Tool
- 13:12 - Using the integrated debugging tools of Eclipse
IntelliJ IDEA
The IntelliJ IDEA is a powerful IDE for professional Java development. IntelliJ IDEA comes in two flavors, a free Community edition and a commercial (paid) Ultimate version. The free Community version of IntellIJ IDEA is sufficient for more AEM development, however the Ultimate expands its capability set.
Installation and Setup
- Download and install the IntelliJ IDEA: https://www.jetbrains.com/idea/download
- Install Repo (command line tool): https://github.com/Adobe-Marketing-Cloud/tools/tree/master/repo
- 00:00 - Import Maven Project
- 05:47 - Build and deploy source code with Maven
- 08:17 - Push changes with Repo
- 14:39 - Pull changes with Repo
- 17:25 - Using the integrated debugging tools of IntelliJ IDEA
Visual Studio Code
Visual Studio Code has quickly become a favorite tool for front-end developers with enhanced JavaScript support, Intellisense, and browser debugging support. Visual Studio Code is open source, free, with many powerful extensions. Visual Studio Code can be set up to integrate with AEM with the help of an Adobe tool, repo. There are also several community-supported extensions that can be installed to integrate with AEM.
Visual Studio Code is a great choice for front-end developers who will primarily be writing CSS/LESS and JavaScript code to create AEM client libraries. This tool may not be the best choice for new AEM developers since node definitions (dialogs, components) will all need to edited in raw XML. There are several Java extensions available for Visual Studio Code, however if primarily doing Java development Eclipse IDE or IntelliJ may be preferred.
Important links
- DownloadVisual Studio Code
- repo - FTP-like tool for JCR content
- aemfed - Speed up your AEM front-end workflow
- AEM Sync - Community supported* extension for Visual Studio Code
- 00:30 - Import Maven Project
- 00:53 - Build and deploy source code with Maven
- 04:03 - Push code changes with Repo command line tool
- 08:29 - Pull code changes with Repo command line tool
- 10:40 - Push code changes with aemfed tool
- 14:24 - Troubleshooting, Rebuild Client Libraries
CRXDE Lite
CRXDE Lite is a browser-based view of the AEM repository. CRXDE Lite is embedded in AEM and allows a developer to perform standard development tasks like editing files, defining components, dialogs, and templates. CRXDE Lite is not intended to be a full development environment but is very effective as a debugging tool. CRXDE Lite is useful when extending or simply understanding product code outside of your code base. CRXDE Lite provides a powerful view of the repository and a way to effectively test and manage permissions.
CRXDE Lite should always be used in conjunction with other IDEs to test and debug code but never as the primary development tool. It has limited syntax support, no auto-complete capabilities and limited integration with source control management systems.
Troubleshooting
Help! My code isn’t working! As with all development, there will be times (probably many), where your code is just not working as expected. AEM is a powerful platform, but with great power… comes great complexity. Below are a few high level starting points when it comes to troubleshooting and tracking down issues (but far from an exhaustive list of things that can go wrong):
Verify Code Deployment
A good first step, when encountering an issue is to verify that the code has been deployed and installed successfully to AEM.
- Check Package Manager to ensure that the code package has been uploaded and installed: http://localhost:4502/crx/packmgr/index.jsp. Check the time stamp to verify the package has been installed recently.
- If doing incremental file updates using a tool like Repo or AEM Developer Tools, check CRXDE Lite that the file has been pushed to the local AEM instance and that the file contents are updated: http://localhost:4502/crx/de/index.jsp
- Check that the bundle is uploaded if seeing issues related to Java code in an OSGi bundle. Open the Adobe Experience Manager Web Console: http://localhost:4502/system/console/bundles and search for your bundle. Ensure that the bundle has an Active status. See below for more information related to troubleshooting a bundle in an Installed state.
Check the Logs
AEM is a chatty platform and logs a lot of useful information in the error.log. The error.log can be found where AEM has been installed: < aem-installation-folder>/crx-quickstart/logs/error.log
.
A useful technique for tracking down issues is to add log statements in your Java Code:
By default the error.log is configured to log INFO statements. If you want to change the log level you can do so by going to Log Support: http://localhost:4502/system/console/slinglog. You may also find that the error.log is too chatty. You can use the Log Support to configure log statements for just a specified Java package. This is a best practice for projects, in order to easily separate custom code issues from OOTB AEM platform issues.
Bundle is in an Installed state
All bundles (excluding Fragments) should be in an Active state. If you see your code bundle in an Installed state then there is an issue that needs to be resolved. Most times this is a dependency issue:
In the above screenshot the WKND Core bundle is an Installed state. This is because the bundle is expecting a different version of com.adobe.cq.wcm.core.components.models
than is available on the AEM instance.
A useful tool that can be used is the Dependency Finder: http://localhost:4502/system/console/depfinder. Add the Java package name to inspect what version is available on the AEM instance:
Adobe Dreamweaver Localhost
Continuing with the above example, we can see that the version installed on the AEM instance is 12.2 vs 12.6 that the bundle was expecting. From there you can work backwards and see if the Maven dependencies on AEM match the Maven dependencies in the AEM project. In the above example Core Components v2.2.0 is installed on the AEM instance but the code bundle was built with a dependency on v2.2.2, hence the reason for the dependency issue.
Verify Sling Models Registration
AEM components should always be backed by a Sling Model to encapsulate any business logic and ensure that the HTL rendering script remains clean. If experiencing issues where the Sling Model cannot be found it may be helpful to check the Sling Models from the console: http://localhost:4502/system/console/status-slingmodels. This will tell you if your Sling Model has been registered and which resource type (the component path) it is tied to.
Shows the registration of a Sling Model, BylineImpl
that is tied to a component resource type of wknd/components/content/byline
.
CSS or JavaScript Issues
For most CSS and JavaScript issues, using the browser’s development tools is the most effective way to troubleshoot. To narrow down the issue when developing against an AEM author instance it is helpful to view the page “as Published”.
Open the Page Properties menu and click View as Published. This will open the page without the AEM editor and with a query parameter set to wcmmode=disabled. This will effectively disable the AEM authoring UI and make troubleshooting/debugging front-end issues much easier.
Another commonly encountered issue when developing front-end code is old or outdated CSS/JS is being loaded. As a first step, ensure that the browser history has been cleared and if necessary start an incognito browsers or fresh session.
Debugging Client Libraries
With different methods of categories and embeds to include multiple client libraries it can be cumbersome to troubleshoot. AEM exposes several tools to help with this. One of the most important tools is Rebuild Client Libraries which will force AEM to re-compile any LESS files and generate the CSS.
- Dump Libs - Lists all of the client libraries registered in the AEM instance. <host>/libs/granite/ui/content/dumplibs.html
- Test Output - allows a user to see the expected HTML output of clientlib includes based on category. <host>/libs/granite/ui/content/dumplibs.test.html
- Libraries Dependencies validation - highlights any dependencies or embedded categories that cannot be found. <host>/libs/granite/ui/content/dumplibs.validate.html
- Rebuild Client Libraries - allows a user to force AEM to rebuild all of the client libraries or invalidate the cache of client libraries. This tool is particularly effective when developing with LESS as this can force AEM to re-compile the generated CSS. In general it is more effective to Invalidate Caches and then perform a page refresh versus rebuilding all of the libraries. <host>/libs/granite/ui/content/dumplibs.rebuild.html
If you are constantly having to invalidate the cache using the Rebuild Client Libraries tool it may be worth it to do a one time rebuild of all client libraries. This may take around 15 minutes, but typically eliminates any caching issues in the future.