Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

5 Maven Plugins to Turbocharge Your AEM Development | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

5 Maven Plugins to Turbocharge Your AEM Development by Daniel Klco

Abstract

A confession, oftentimes I use this blog as a bookmark for helpful tools and information that's scattered across the internet. This is most definitely one of those type of posts. Hopefully you find it helpful too!

There are numerous plugins for Maven which make it easier to work with AEM from the command line, however the documentation for the plugins is sprinkled across a number of plugin sites. Mastering these Maven commands makes it easier and quicker for you to develop code.

I'd note this post doesn't cover "basic" Maven commands such as installing an AEM project, but instead focuses on less-common but invaluable commands.


Getting "Stuff" Into AEM


AEM makes it pretty easy to get content / code in and out of the system with JCR FileVault Packages and OSGi Bundles. With these Maven plugins you can automate it!


#1 Install / Download Content Packages with the content-package-maven-plugin

JCR FileVault Packages are the easiest way to get content in and out of AEM, allowing for developers and administrators to easily package, download and install content between AEM instances.

Adobe provides the Content Package Maven Plugin which besides being critical to code deployments can be used for ad-hoc package installation.


# Install a package artifact from Maven
mvn content-package:install -Dvault.artifact=com.adobe.aem.guides:aem-guides-wknd.all:1.1.0:zip

# Installing a local file
mvn content-package:install -Dvault.file=./package.zip

You can use the content package plugin to install external content packages, but it also can be used as a one liner for building and installing your project with:


# Build and install an AEM project
mvn clean install content-package:install

You can even use the content package plugin to back up content in an instance automatically.


# First we build the package
mvn content-package:build -Dvault.path=/etc/packages/com.adobe.aem-assets/test-content.zip -DfailOnError=true

# Next, download the package
mvn content-package:download -Dvault.path=/etc/packages/com.adobe.aem-assets/test-content.zip -Dvault.outputFile=test-content.zip

# Do whatever you need to do...

# Reinstall the package
mvn content-package:install -Dvault.file=test-content.zip

#2 Install Bundles with the sling-maven-plugin

OSGi bundles contain the Java code for AEM projects. While you generally won't need to download a bundle from an AEM instance, with the sling-maven-plugin can deploy a bundle with a single command!

First, if you already have built your project and just want to install it, you can run:

# Install the bundle in the current project directory
mvn sling:install

Read Full Blog

5 Maven Plugins to Turbocharge Your AEM Development

Q&A

Please use this thread to ask the related questions.

0 Replies