Currently there is no popular way to build applications for AEM using Gradle build system. This project contains brand new Gradle plugin to assemble CRX package and deploy it on instance(s).
Incremental build which takes seconds, not minutes. Developer who does not loose focus between build time gaps. Extend freely your build system directly in project.
AEM developer - it's time to meet Gradle!
- Composing CRX package from multiple JCR content roots, bundles.
- Easy multi-deployment with instance groups.
- Service component annotations processing (SCR).
- OSGi manifest customization by official osgi plugin or feature rich org.dm.bundle plugin.
- Automated dependent packages installation from local and remote sources.
- Smart Vault files generation (combining defaults with overiddables).
- Checking out and cleaning JCR content from running AEM instance.
- Java >= 8, but target software can be compiled to older Java.
- Gradle >= 3.5.
Recommended way to start using Gradle AEM Plugin is to clone and customize example project. All configuration options are listed here.
Released versions of plugin are available on Bintray, so that this repository need to be included in buildscript section.
buildscript {
repositories {
maven { url "http://dl.bintray.com/cognifide/maven-public" }
}
dependencies {
classpath 'com.cognifide.gradle:aem-plugin:1.0.+'
}
}
Custom Gradle plugins need to have section above configured in all sub projects that need that custom plugin. As a consequence, it is worth to know approach for simplification used in example project.
Example configuration listed below assumes building project by single command gradle contentDeploy
or just gradle
.
defaultTasks = ['contentDeploy']
plugins.withId 'cognifide.aem', {
aem {
config {
contentPath = "src/main/content"
instance("http://localhost:4502", "admin", "admin", "local-author")
// instance("http://localhost:4503", "admin", "admin", "local-publish")
}
}
}
Instances configuration can be omitted, then http://localhost:4502 and http://localhost:4503 will be used by default. Content path can also be skipped, because value above is also default. This is only an example how to customize particular values.
defaultTasks = ['contentDeploy']
apply plugin: 'cognifide.aem'
aem {
config {
contentPath = "src/main/aem"
}
}
aemSatisfy {
// local("pkg/vanityurls-components-1.0.2.zip")
download("https://github.com/Cognifide/APM/releases/download/cqsm-3.0.0/apm-3.0.0.zip")
}
aemCompose {
includeProject ':example.bundle'
}
build.dependsOn aemCompose
task contentDeploy(dependsOn: [clean, build, aemDeploy])
Snippet above demonstrates customizations valid only for specific project.
aemCompose
- Compose CRX package from JCR content and bundles. Available methods:includeProject(projectName: String)
, includes both bundles and JCR content from another project, example:includeProject ':example.bundle'
.includeContent(projectName: String)
, includes only JCR content, example:includeContent ':example.design'
.includeBundles(projectName: String)
, includes only bundles, example:includeBundles ':example.auth'
.- all inherited from ZIP task.
aemUpload
- Upload composed CRX package into AEM instance(s).aemInstall
- Install uploaded CRX package on AEM instance(s).aemActivate
- Replicate installed CRX package to other AEM instance(s).aemDeploy
- Upload & install CRX package into AEM instance(s). Primary, recommended form of deployment. Optimized version ofaemUpload aemInstall
.aemDistribute
- Upload, install & activate CRX package into AEM instances(s). Secondary form of deployment. Optimized version ofaemUpload aemInstall aemActivate -Paem.deploy.instance.group=*-author
.aemSatisfy
- Upload & install dependent CRX package(s) before deployment. Available methods:local(path: String)
, use CRX package from local file system.local(file: File)
, same as above, but file can be even located outside the project.download(url: String)
, use CRX package that will be downloaded from specified URL to local temporary directory.downloadBasicAuth(url: String, user = "admin", password = "admin")
, as above, but with Basic Auth support.
aemCheckout
- Check out JCR content from running AEM author instance to local content path.aemClean
- Clean checked out JCR content.aemSync
- Check out then clean JCR content.
- Deploying only to filtered group of instances
-Paem.deploy.instance.group=integration-*
-Paem.deploy.instance.group=*-author
- Deploying only to instances specified explicitly:
-Paem.deploy.instance.list=http://localhost:4502,admin,admin;http://localhost:4503,admin,admin
- Skipping installed package resolution by download name (eliminating conflicts / only matters when Vault properties file is customized):
-Paem.deploy.skipDownloadName=true
Gradle AEM Plugin is licensed under the Apache License, Version 2.0 (the "License")