This sample (working) project acts as a guide
to help you get started with aio-aem-events
Here are the few steps to redo it from scratch:
Generate your project using AEM Project Archetype, with the following command line :
mvn -B archetype:generate \
-D archetypeGroupId=com.adobe.aem \
-D archetypeArtifactId=aem-project-archetype \
-D archetypeVersion=36 \
-D appTitle="My Site" \
-D appId="mysite" \
-D groupId="com.mysite"
Optionally (we did it to keep the sample easy to manage and understand) remove the unnecessary modules
- remove all modules but
all
andui.apps.structure
- remove their reference from the root
pom.xml
andall/pom.xml
files
aio-aem-events
expects a workspace OSGI configuration
defined: for this add a new container
package named aio.config
to hold this configuration.
If you target AEM as a Cloud Service, we strongly encourage the use of AEM Cloud Manager secret
and env
environment variables
(see Configuring OSGi for Adobe Experience Manager as a Cloud Service).
Your OSGI configuration could look like this:
{
"aio.consumer.org.id": "$[env:aio_consumer_org_id]",
"aio.ims.org.id": "$[env:aio_ims_org_id]",
"aio.meta.scopes": "$[env:aio_meta_scopes]",
"aio.project.id": "$[env:aio_project_id]",
"aio.workspace.id": "$[env:aio_workspace_id]",
"aio.api.key": "$[env:aio_api_key]",
"aio.credential.id": "$[env:aio_credential_id]",
"aio.technical.account.id": "$[env:aio_technical_account_id]",
"aio.client.secret": "$[secret:aio_client_secret]",
"aio.encoded.pkcs8": "$[secret:aio_encoded_pkcs8]"
}
Confer our sample Workspace OSGI configuration
Now we have the configuration ready, the last step is to
add aio-aem-events
and aio.config
as an Embedded/Sub packages.
For this edit all/pom.xml
file, and
-
set
aio-aem-events.version
in theproperties
section to use the latest version from maven central -
add
aio-aem-events
andaio.config
in thedependencies
section<dependency> <groupId>com.mysite</groupId> <artifactId>mysite.aio.config</artifactId> <version>${project.version}</version> <type>zip</type> </dependency> <dependency> <groupId>com.adobe.aio.aem</groupId> <artifactId>aio-aem-events</artifactId> <version>${aio-aem-events.version}</version> <type>zip</type> </dependency>
-
add
aio-aem-events
andaio.config
as an Embedded/Sub packages, in thefilevault-package-maven-plugin
embedded
configuration
section:<embedded> <groupId>com.mysite</groupId> <artifactId>mysite.aio.config</artifactId> <type>zip</type> <target>/apps/mysite-packages/application/install</target> </embedded> <embedded> <groupId>com.adobe.aio.aem</groupId> <artifactId>aio-aem-events</artifactId> <type>zip</type> <target>/apps/mysite-packages/application/install</target> </embedded>
As detailed above, this sample is leveraging environment variables, you will need to define these in your system.
- for local configuration, you may use the
export
bash command to load the system environment variables, for your aem child process to inherit. - for AEM as a Cloud Service configuration read the Cloud Manager environment variables guide.
To build all the modules run in the project root directory the following command with Maven 3:
mvn clean install
To build all the modules and deploy the all
package to a local instance of AEM, run in the project root directory the following command:
mvn clean install -PautoInstallSinglePackage
Or to deploy it to a publish instance, run
mvn clean install -PautoInstallSinglePackagePublish
Or alternatively
mvn clean install -PautoInstallSinglePackage -Daem.port=4503
To deploy it on your AEM as a Cloud Service, read the AEM Cloud Manager deployment guide
The project comes with the auto-public repository configured. To setup the repository in your Maven settings, refer to:
https://helpx.adobe.com/experience-manager/kb/SetUpTheAdobeMavenRepository.html