Posts

Showing posts from June, 2019

Creating or finding .M2 folder

Image
If you are setting up your system for first time, you have installed java set path variable for java and maven both. You checked both are installed successfully but if .m2 & repository both folder are not there in then do the below things. open Command promt run the below command mvn help:evaluate -Dexpression=settings.localRepository It will help you to find the location of .m2 if someone has changed. Also if there is no folder created it will create .m2/repository folder under C:\Users\{user}\ If you run this command for first time it will download repository so it will take some time. That's it and your folder is created. After repository creation make sure you are giving the same path in setting.xml localrepository   <!-- localRepository    | The path to the local repository maven will use to store artifacts.    |    | Default: ${user.home}/.m2/repository   <localRepository>/path/to/local/repo</localRepository>   --> KEEP EDUCAT

Create Custom metadata in aem

Image
Metadata refers to extra data associated with assets that we upload in aem dam so we can describe asset with more details. Follow below steps to create custom metadata schema. Step 1. Navigate Tools ->Asset -> Metadata Schema Click On Metadata Schema. Step 2: Click on Create to create new Metadata Schema. Step 3: Enter name for Schema Form which is suitable for your project Step 4: Click on Edit to Edit Schema which you have created so you can add your custom metadata It will open the schema like above Step 5: Now start adding Custom metadata 1st Click on + sign to add tab once you add tab enter name for tab from settings tab present at right side, you can multiple tabs. Step 6: Under tabs add the different field as per your requirement from Build Form tab. To add field just drag and drop fields from Build Form. Step 7: Add details from Settings tab at right side like Field Label, Map to property, placeholder names. Map to prope

Servlet in AEM

What/Why servlet Creating/registering a servlet in aem What/why servlet: Servlet is a JAVA class used to extend the capabilities of server using request/response programming model. Creating/registering a servlet in aem: Servlet can be registered as OSGI service using SCR annotations or using OSGI declarative services Register servlet using SCR annotation @SlingServlet(paths="/bin/learnAEM", methods = "GET") public class TestServlet extends SlingSafeMethodsServlet { private static final long serialVersionUID = 2598426539166789515L;                  @Override      protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServerException, IOException {     response.setContentType("text/json");     PrintWriter out = response.getWriter();     out.println("test data");     out.close();         } } This is the sample example of servlet here we used the @SlingServlet scr annotation

Debugging in AEM

Image
 We have 2 ways of debugging in AEM. debug AEM using eclipse debug AEM from front end i.e from AEM  Debug AEM using eclipse  Step 1: Add the remote debugging JVM parameter  in start.bat (Path:D:\new aem\author\crx-quickstart\bin\start.bat) as below. ::* default JVM options if not defined CQ_JVM_OPTS set CQ_JVM_OPTS=-Xmx1024m -XX:MaxPermSize=256M -Djava.awt.headless=true -agentlib:jdwp=transport=dt_socket,address=30338,server=y,suspend=n save the changes and start aem using double clicking jar file address=30338 will open socket for us you can change port number. ------------------------------------------------------OR------------------------------------------------------- Start aem using below command To run this command go to folder where your aem jar file resides, open command prompt and run below command. Make sure you are same jar file name in command and folder. java -Xmx1024M -agentlib:jdwp=transport=dt_socket,address=30338,server=y,suspend=n -jar

Creating AEM project using Maven Archetype

Image
before creating AEM project make sure you have set JAVA_HOME: C:\Program Files\AdoptOpenJDK\jdk-8.0.202.08 M2_HOME: C:\ApacheMaven_3.5.2 also make sure your settings.xml file is ready at .m2 path C:\Users\user_name\.m2 or under C:\ApacheMaven_3.5.2\conf if not ready do the needful changes. below is the adobes public profile you can add to settings.xml file </ profiles > < profile >        < id >adobe-public</ id >      < activation >                  < activeByDefault >true</ activeByDefault >          </ activation >          < repositories >              < repository >                  < id >adobe</ id >                  < name >Nexus Proxy Repository</ name >                  < url > http://repo.adobe.com/nexus/content/groups/public/ </ url >                  < layout >default</ layout >              </ repository >          <