Skip to main content

AEM Sites maven

Getting Started with AEM Sites

Prerequisites

A local development environment is necessary to complete this tutorial.

The following is required:

1.        Java 1.8

2.        Apache Maven (3.3.9 or newer)

3.        AEM 6.4 + Service Pack 2 or 

4.        AEM 6.3 + Service Pack 3

5.        Eclipse or other IDE

 

Create Project with Maven AEM Project Archetype 13

There are a couple options for creating a Maven Multimodule project for AEM. This tutorial will leverage the Maven AEM Project Archetype 13.

 

Verify Maven Version -> $ mvn -version

add an 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 ${user.home}/.m2/settings.xml if it doesn't exist already. 

Add the adobe-public profile to the settings.xml

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0

                      https://maven.apache.org/xsd/settings-1.0.0.xsd">

 

<profiles>

<!-- ====================================================== -->

<!-- P U B L I C P R O F I L E -->

<!-- ====================================================== -->

<profile>

    <id>adobe-public</id>

  

    <activation>

        <activeByDefault>false</activeByDefault>

    </activation>

  

    <properties>

  

        <releaseRepository-Id>adobe-public-releases</releaseRepository-Id>

        <releaseRepository-Name>Adobe Public

            Releases</releaseRepository-Name>

  

        <releaseRepository-URL>http://repo.adobe.com/nexus/content/groups/public</releaseRepository-URL>

    </properties>

  

    <repositories>

        <repository>

            <id>adobe-public-releases</id>

            <name>Adobe Basel Public Repository</name>

            <url>http://repo.adobe.com/nexus/content/groups/public</url>

            <releases>

                <enabled>true</enabled>

                <updatePolicy>never</updatePolicy>

            </releases>

            <snapshots>

                <enabled>false</enabled>

            </snapshots>

        </repository>

    </repositories>

  

    <pluginRepositories>

        <pluginRepository>

            <id>adobe-public-releases</id>

            <name>Adobe Basel Public Repository</name>

            <url>http://repo.adobe.com/nexus/content/groups/public</url>

            <releases>

                <enabled>true</enabled>

                <updatePolicy>never</updatePolicy>

            </releases>

            <snapshots>

                <enabled>false</enabled>

            </snapshots>

        </pluginRepository>

    </pluginRepositories>

</profile>

 

</profiles>

<activeProfiles>

<activeProfile>adobe-public</activeProfile>

  </activeProfiles>

</ settings>

 

Create Maven Archetype

mvn -B archetype:generate -DarchetypeGroupId=com.adobe.granite.archetypes -DarchetypeArtifactId=aem-project-archetype -DarchetypeVersion=13 -DaemVersion=6.4.0 -DappTitle="My Site" -DappId="mysite" -DgroupId="com.mysite" -DincludeExamples=y -DsingleCountry=n -DartifactId="mysite"

Run on cmd or powershell

 

Description

Property

Value

Maven group id

groupId

com.mysite

Maven artifact id

artifactId

mysite

Starting version of project

version

0.0.1-SNAPSHOT

Java source package

package

com.mysite

/apps folder name

appsFolderName

mysite

Maven project name

artifactName

mysite Project

AEM component group name

componentGroupName

mysite.Content

/conf folder name

confFolderName

mysite

/content folder name

contentFolderName

mysite

Prefix used in generated CSS

cssId

mysite

Content Package group name

packageGroup

mysite

AEM site name

siteName

mysite Site

Build your project

$ cd mysite

$ mvn -PautoInstallPackage -Padobe-public clean install

 

 

Code is available on github https://github.com/jaykrs/mysite

View Packages on AEM

Navigate to Package Manager on your local AEM instance: http://localhost:4502/crx/packmgr/index.jsp. You should see the following 5 packages installed:



Navigate to the AEM Sites Console: http://localhost:4502/sites.html

The mysite Site will be one of the sites. It will include two content pages, one for English and one for French.



 

Inspecting the Project Structure

There are six areas to the project:

1.        Parent POM - deploys maven modules and manages dependency versions

2.        core - Java bundle containing all core functionality like OSGi services, listeners or schedulers, as well as component-related Java code such as servlets or request filters.

3.        ui.apps - contains the /apps parts of the project, ie JS&CSS clientlibs, components, runmode specific configs as well as Hobbes-tests

4.        ui.content - contains structural content and configurations (/content, /conf)

5.        ui.tests - Java bundle containing JUnit tests that are executed server-side. This bundle is not to be deployed onto production.

6.        ui.launcher - contains glue code that deploys the ui.tests bundle (and dependent bundles) to the server and triggers the remote JUnit execution



As of now our Basic AEM site with required project has been created and running on AEM author server. Lets move on to create basic side ready for template and css with layout.


Comments

Popular posts from this blog

OSGI

 OSGI Annotation Mapping to OSGi Declarative Services Annotations The below table gives you an overview of how to map the annotations. Annotation Mapping APACHE FELIX SCR ANNOTATION DESCRIPTION OSGI DECLARATIVE SERVICES ANNOTATION DESCRIPTION @Component The @Component annotation marks a Java class to be used as a component. @Component This is more or less a strict one-to-one replacement. Only difference is the default behavior for services. See below. @Service Marks the component as a service and optionally lists the provided services (classes) @Component The OSGi annotation has a service attribute which should be used to list the provided services. Be careful, if your component should not provide any service, set this attribute to an empty array. @Reference Reference to services, can be used on unary fields or on class level with bind/unbind methods. @Reference Field references can directly be migrated, for event based references (methods), the @Reference annotation must be p...

Akamai CDN

  Leveraging Akamai CDN for Enterprise Applications: Features and Benefits Leveraging Akamai CDN for Enterprise Applications: Features and Benefits Table of contents • Introduction • Features of Akamai CDN • Benefits of Akamai CDN • Use Cases of Akamai CDN • Akamai CDN vs Traditional CDN • How to Choose the Right CDN for Your Enterprise Application? • Conclusion Introduction What is a Content Delivery Network (CDN)? It's like having a team of roadies who transport your equipment from one gig to another, making sure everything arrives safely and on time. In the digital world, a CDN does the same thing for website content, delivering it from server to server so that it reaches the end user quickly and efficiently. And when it comes to CDNs, Akamai is definitely the Mick Jagger of the industry. With its cloud-based technology, high-performance content delivery, advanced security, and real-time analytics, Akamai CDN offers an impressive package of features that's hard to beat. So...

future of artificial intelligence

A new wave of artificial intelligence breakthroughs is making it possible for technology to do all sorts of things we at first can't believe and then quickly take for granted. That's making our lives easier and more productive, and it's also raising a new round of excitement and angst about where artificial intelligence is headed. "Right now we're in a phase of very fast advances, and that may well continue for a small number of years," said Christopher Bishop, a distinguished scientist with Microsoft Research Cambridge. With advances in machine learning, including deep neural networks and probabilistic models, computers can now instantly translate spoken and written conversation, recognize and accurately caption photos, identify faces and be your personal assistant. And yet, although they can do some individual tasks as well as or even better than humans, technology still cannot approach the complex thinking that humans have. "It's a long way fro...