Posts

AEM Project Maven Build - Easy setup and steps to run commands via command line

We generally run maven commands every day to deploy the bundles or any other changes in the project to AEM server. There are a lot of options to sync them automatically like using Brackets or AEM Server plugin configurations in IDE's etc.. These are very faster for deployments and changes to be reflected in AEM server In case if you would like to do a complete build, we can run the same from Eclipse by using the run commands or via command prompt using the complete maven command but IDE's generally occupy lot of memory and might slow down sometimes. I generally use Command prompt for the builds. I generally navigate to the repo folder and type the maven command " mvn clean install -PautoInstallPackage,adobe-public " Note: adobe-public can be ignored if you already set the repo in the maven settings I work on different projects and repositories every day and navigating to different folders and typing the same command (You can always copy and paste the comman

AEM - Workaround Solution for Clean up of Packages from Package Manager in AEM

Image
AEM Packages Clean up from Package Manager  Most of the times, the repository spaces get occupied with a lot of content and as well as packages. We create the packages to bring down the content from higher environments to lower environments or vice-versa and most of the times, we don't delete them from the environment. This will also increase the usage of the repository and cleaning up at some point later is very painful, as there is no direct way to check the larger packages and delete them. There is no sorting option available in the package manager and when you have hundreds of packages, it will be a tedious process to go through every package and clean it up. Currently, only below sort options are available in the system. Name Last modified Installation date Recently added Below solution is also a manual process but it will provide the packages which are of a size more than 30/40/50 MB(this can be configurable) by running a small script in java using any IDE. I tr

Add a custom button in AEM DAM console and validate the asset Before Deleting

Image
Add a custom button in AEM DAM Console (Touch UI) Sling Merger is the best way to overlay and hide/add any buttons in components or even AEM consoles. If you would like to do any custom action on the assets, for ex: Validate the asset before deleting, you can follow the below process. Use Case Scenario: When we select the asset and click on the delete, there is no way of holding that activity, we can catch the events by using Event Listeners and do any activity post deletion, but if you would like to make any check's before deletion and stop deleting the asset, There are a couple of options for this requirement 1. Create a workflow and assign the workflow to the asset to do the activity 2. Add a custom button and call a servlet to do required actions, if you are satisifed the conditions in the servlet, you can delete it directly or you can hold the deletion and send emails or any other actions. You can even call a workflow from the servlet to do the activity if any

Delete DAM Asset using Workflow

This article shows you to create a simple workflow process step and use it for deleting an DAM Asset. You can ask me why do I need a workflow when I can delete it directly using the delete button :) The intention is to validate the asset information before deleting the asset or trigger any other workflow for the asset and do manipulations like updating the asset data to an user before the deletion as you will not be able to get that post deletion. you can catch the events in the Event Listeners, but there will be no data by then. Simple Workflow Process Step Create a workflow process step by using the below example package com.flash.aem.core.workflow; import java.util.HashMap; import java.util.Map; import javax.jcr.Node; import javax.jcr.RepositoryException; import javax.jcr.Session; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; import org.osgi.

Standalone scripts to execute in AEM

Few sample scripts which can be run from any IDE are available in the below GITHUB repository. ReadChildNodes CreatePage Github URL:  https://github.com/sudheerdvn/standalone-scripts Will try to add more scripts going on.

Groovy Console Integration and executing scripts in AEM

Image
Steps to install Groovy in AEM. Below Github have the steps to install the latest Groovy console https://github.com/icfnext/aem-groovy-console You can also navigate to the releases section and download the required package. https://github.com/icfnext/aem-groovy-console/releases I have used 12.0.0 version for this demo. Download the Groovy Package ( Direct link to the package  ) Upload the package to AEM via Package manager  http://localhost:4502/crx/packmgr/index.jsp Once the package is installed, you should be able to access the groovy console  http://localhost:4502/etc/groovyconsole.html Note: From 13.0.0 release, the paths were changed from /etc/ to /apps/ to access Groovy Console Sample Groovy Scripts: Printing a simple String println 'Hello World'; Click on Run Script Displays Hello World in the Console Get a Page Object final def page = getPage('/content/aem-flash') println 'page path is: ' + page.path; Re