ÃÛ¶¹ÊÓƵ Content Package Maven Plugin adobe-content-package-maven-plugin
Use the ÃÛ¶¹ÊÓƵ Content Package Maven plugin to integrate package deployment and management tasks into your Maven projects.
The deployment of the constructed packages to AEM is performed by the ÃÛ¶¹ÊÓƵ Content Package Maven plugin and enables the automation of tasks normally performed using AEM Package Manager:
- Create new packages from files in the file system.
- Install and uninstall packages on AEM.
- Build packages that are already defined on AEM.
- Obtain a list of packages that are installed on AEM.
- Remove a package from AEM.
This document details how to use the Maven to manage these tasks. However it is also important to understand how AEM projects and their packages are structured.
Packages and the AEM Project Structure aem-project-structure
AEM as a Cloud Service adheres to the latest best practices for package management and project structure as implemented by the latest AEM Project Archetype.
Obtaining the Content Package Maven Plugin obtaining-the-content-package-maven-plugin
The plugin is available from the
Content Package Maven Plugin Goals and Parameters
To use the Content Package Maven Plugin, add the following plugin element inside the build element of your POM file:
<plugin>
<groupId>com.day.jcr.vault</groupId>
<artifactId>content-package-maven-plugin</artifactId>
<version>1.0.4</version>
<configuration>
<!-- parameters and values common to all goals, as required -->
</configuration>
</plugin>
To enable Maven to download the plugin, use the profile provided in the Obtaining the Content Package Maven Plugin section on this page.
Goals of the Content Package Maven Plugin goals-of-the-content-package-maven-plugin
The goals and goal parameters that the Content Package plugin provides are described in the sections that follow. Parameters that are described in the Common Parameters section can be used for most of the goals. Parameters that apply to one goal are described in the section for that goal.
Plugin Prefix plugin-prefix
The plugin prefix is content-package
. Use this prefix to execute a goal from the command line, as in the following example:
mvn content-package:build
Parameter Prefix parameter-prefix
Unless otherwise noted, the plugin goals and parameters use the vault
prefix, as in the following example:
mvn content-package:install -Dvault.targetURL="https://192.168.1.100:4502/crx/packmgr/service.jsp"
Proxies proxies
Goals that use proxies for AEM use the first valid proxy configuration found in the Maven settings. If no proxy configuration is found, no proxy is used. See the useProxy
parameter in the Common Parameters section.
Common Parameters common-parameters
The parameters in the following table are common to all goals except when noted in the Goals column.
failOnError
boolean
false
true
causes the build to fail when an error occurs. A value of false
causes the build to ignore the error.package
name
String
build
: Yes, install
: No, rm
: Yesbuild
: No default, install
: The value of the artifactId
property of the Maven projectls
password
String
admin
package
serverId
String
package
targetURL
String
http://localhost:4502/crx/packmgr/service.jsp
package
timeout
int
5
package
useProxy
boolean
true
true
causes Maven to use the first active proxy configuration found to proxy requests to the Package Manager.package
userId
String
admin
package
verbose
boolean
false
package
build build
Builds a content package that is already defined on an AEM instance.
Parameters parameters
All parameters for the build goal are described in the Common Parameters section.
install install
Installs a package in the repository. Execution of this goal does not require a Maven project. The goal is bound to the install
phase of the Maven build lifecycle.
Parameters parameters-1
In addition to the following parameters, see the descriptions in the Common Parameters section.
artifact
String
artifactId
property of the Maven projectgroupId:artifactId:version[:packaging]
artifactId
String
groupId
String
groupId
of the artifact to installinstall
boolean
true
localRepository
org.apache.maven.artifact.repository.ArtifactRepository
localRepository
system variablepackageFile
java.io.File
packaging
String
zip
pomRemoteRepositories
java.util.List
remoteArtifactRepositories
property that is defined for the Maven projectproject
org.apache.maven.project.MavenProject
repositoryId
(POM), repoID
(command line)String
temp
repositoryUrl
(POM), repoURL
(command line)String
ls ls
Lists the packages that are deployed to Package Manager.
Parameters parameters-2
All parameters of the ls goal are described in the Common Parameters section.
rm rm
Removes a package from Package Manager.
Parameters parameters-3
All parameters of the rm goal are described in the Common Parameters section.
uninstall uninstall
Uninstalls a package. The package remains on the server in the uninstalled state.
Parameters parameters-4
All parameters of the uninstall goal are described in the Common Parameters section.
help help
Parameters parameters-6
detail
boolean
false
goal
String
indentSize
int
2
lineLength
int
80
Including a Thumbnail Image or Properties File in the Package including-a-thumbnail-image-or-properties-file-in-the-package
Replace the default package configuration files to customize the package properties. For example, include a thumbnail image to distinguish the package in Package Manager.
The source files can be located anywhere in your file system. In the POM file, define build resources to copy the source files to the target/vault-work/META-INF
for inclusion in the package.
The following POM code adds the files in the META-INF
folder of the project source to the package:
<build>
<resources>
<!-- vault META-INF resources (thumbnail and so on) -->
<resource>
<directory>${basedir}/src/main/content/META-INF</directory>
<targetPath>../vault-work/META-INF</targetPath>
</resource>
</resources>
</build>
The following POM code adds only a thumbnail image to the package. The thumbnail image must be named thumbnail.png
, and must be located in the META-INF/vault/definition
folder of the package. In this example, the source file is located in the /src/main/content/META-INF/vault/definition
folder of the project:
<build>
<resources>
<!-- thumbnail only -->
<resource>
<directory>${basedir}/src/main/content/META-INF/vault/definition</directory>
<targetPath>../vault-work/META-INF/vault/definition</targetPath>
</resource>
</resources>
</build>
Using the AEM Project Archetype to Generate AEM Projects using-archetypes
The latest AEM Project Archetype implements the best-practice package structure for both on-premises and AMS implementations and is recommended for all AEM projects.