Managing Packages Using Maven

You are reading the Adobe Experience Manager 5.6.1 version of Managing Packages Using Maven.
This documentation is also available for the following versions: AEM 5.6  CQ 5.5 

Use the Content Package Maven plugin to integrate package management tasks into your Maven projects. The plugin goals and parameters enable you to automate many of the tasks that you would normally perform using the Package Manager page or the FileVault command line:

  • Create new packages from files in the file system.
  • Install and uninstall packages on the CRX or CQ server.
  • Build packages that are already defined on the server.
  • Obtain a list of packages that are installed on the server.
  • Remove a package from the server.

Adding the Content Package Maven Plugin to the POM File

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>0.0.20</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

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

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

Unless otherwise noted, the plugin goals and parameters use the vault prefix, as in the following example:

mvn content-package:install -Dvault.targetURL="http://192.168.1.100:4502/crx/packmgr/service.jsp"
        

Proxies

Goals that use proxies for the CRX or CQ server 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 Settings section.

Common Parameters

The parameters in the following table are common to all goals except when noted in the Goals column.

Name Type Required Default Value Description Goals
failOnError boolean No false A value of true causes the build to fail when an error occurs. A value of false causes the build to ignore the error. All goals except package.
name String build: Yes
install: No
rm: Yes
Build: No default.
install: The value of the artifactId property of the Maven project.
The name of the package to act on. All goals except ls.
password String Yes admin The password used for authentication with the CRX server. All goals except package.
serverId String No The server ID from which to retrieve the user name and password for authentication. All goals except package.
targetURL String Yes http://localhost:4502/
crx/packmgr/
service.jsp
The URL of the HTTP service API of the CRX package manager. All goals except package.
timeout int No 5 The connection timeout for communicating with the package manager service, in seconds. All goals except package.
useProxy boolean No true Determines whether to use proxy configurations from the Maven settings file. A value of true causes the use of the first active proxy configuration found to proxy requests to the package manager. A value of false causes no proxy to be used. All goals except package.
userId String Yes admin The user name to authenticate with the CRX server. All goals except package.
verbose boolean No false Enables or disables verbose logging. A value of true enables verbose logging. All goals except package.

build

Builds a content package that is already defined on a CRX or CQ5 server.

Note

This goal does not need to be executed within a Maven project.

Parameters

All paramaters for the build goal are described in the Common Parameters section.

Example

The following example builds the workflow-mbean package that is installed on the CQ server with the IP address 10.36.79.223. The goal is executed using the followng command:

mvn content-package:build
        

The following POM file is located in the current directory of the command line tool. The POM specifies the package name and the URL of the package service.

<project xmlns="http://maven.apache.org/POM/4.0.0" 
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
		xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.adobe.example</groupId>
  <artifactId>example-package</artifactId>
  <version>0.0.1-SNAPSHOT</version>
    <build>
        <plugins>
	    <plugin>
		<groupId>com.day.jcr.vault</groupId>
		<artifactId>content-package-maven-plugin</artifactId>
		<version>0.0.20</version>
		<configuration>
			<name>workflow-mbean</name>
			<failOnError>true</failOnError>
			<targetURL>http://10.36.79.223:4502/crx/packmgr/service.jsp</targetURL>
		</configuration>
	    </plugin>
	</plugins>
    </build>
</project>
        

install

Installs a package in the CRX respository. Execution of this goal does not require a Maven project. The goal is bound to the Install phase of the Maven build lifecycle.

Parameters

In addition to the following parameters, see the descriptions in the Common Parameters section.

Name Type Required Default Value Description
artifact String No The value of the artifactId property of the Maven project. A string of the form groupId:artifactId:version[:packaging].
artifactId String No The ID of the artifact to install
groupId String No The groupId of the artifact to install
install boolean No true Determines whether to unpack the package automatically when it is uploaded. A value of true unpacks the package, and false does not unpack the package.
localRepository org.apache.maven.
artifact. repository.
ArtifactRepository
No The value of the localRepository system variable. The local Maven repository. You cannot configure this paramter using the plugin configuration. The system property is always used.
packageFile java.io.File No The primary artifact that is defined for the Maven project. The name of the package file to install.
packaging String No zip The type of packaging of the artifact to install
pomRemoteRepositories java.util.List Yes The value of the remoteAtifactRepositories property that is defined for the Maven project. This value cannot be configured using the plugin configuration. The value must be specified in the project. 
project org.apache.maven.
project.MavenProject
Yes The project for which the plugin is configured. The Maven project. The project is implicit because the project contains the plugin configuration.
repositoryId (POM)
repoID (command line)
String No temp The ID of the repository from which the artifact is retrieved. In a POM, use repositoryID. In a command line, use repoID.
repositoryUrl (POM)
repoURL (command line)
String No The URL of the repository from which the artifact is retrieved.  In a POM, use repositoryURL. In a command line, use repoURL.
version String No The version of the artifact to install.

Example

The following example creates a package that contains the workflow-mbean OSGi bundle (see the example for the build goal) and then installs the package. Because the install goal is bound to the package install phase, the following command executes the install goal:

mvn install
        
<project xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
    http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.adobe.example.myapp</groupId>
  <artifactId>workflow-mbean</artifactId>
  <version>0.0.3-SNAPSHOT</version>

  <build>
    <plugins>
      <plugin>
        <groupId>com.day.jcr.vault</groupId>
        <artifactId>content-package-maven-plugin</artifactId>
        <version>0.0.20</version>
        <configuration>
          <builtContentDirectory>jcr_root</builtContentDirectory>
          <targetURL>http://10.36.79.223:4502/crx/packmgr/service.jsp</targetURL>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>package</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
        

ls

Lists the packages that are deployed to Package Manager.

Parameters

All parameters of the ls goal are described in the Common Parameters section.

Example

The following example lists the packages that are installed on the CQ server with the IP address 10.36.79.223. The goal is executed using the followng command:

mvn content-package:ls
        

The following POM file is located in the current directory of the command line tool. The POM specifies the URL of the package service.

<project xmlns="http://maven.apache.org/POM/4.0.0" 
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
		xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.adobe.example</groupId>
  <artifactId>example-package</artifactId>
  <version>0.0.1-SNAPSHOT</version>
    <build>
        <plugins>
	    <plugin>
		<groupId>com.day.jcr.vault</groupId>
		<artifactId>content-package-maven-plugin</artifactId>
		<version>0.0.20</version>
		<configuration>
		    <targetURL>http://10.36.79.223:4502/crx/packmgr/service.jsp</targetURL>
		</configuration>
	     </plugin>
	  </plugins>
     </build>
</project>
        

rm

Removes a package from Package Manager.

Parameters

All parameters of the rm goal are described in the Common Parameters section.

Example

The following example removes the workfow-mbean package that is installed on the CQ server with the IP address 10.36.79.223. The goal is executed using the followng command:

mvn content-package:rm
        

The following POM file is located in the current directory of the command line tool. The POM specifies the URL of the package service and the name of the package.

<project xmlns="http://maven.apache.org/POM/4.0.0" 
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
		xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.adobe.example</groupId>
  <artifactId>example-package</artifactId>
  <version>0.0.1-SNAPSHOT</version>
    <build>
        <plugins>
	    <plugin>
		<groupId>com.day.jcr.vault</groupId>
		<artifactId>content-package-maven-plugin</artifactId>
		<version>0.0.20</version>
		<configuration>
                    <name>workflow-mbean</name>
		    <targetURL>http://10.36.79.223:4502/crx/packmgr/service.jsp</targetURL>
		</configuration>
	     </plugin>
	  </plugins>
     </build>
</project>
        

uninstall

Uninstalls a package. The package remains on the server in the uninstalled state.

Parameters

All parameters of the uninstall goal are described in the Common Parameters section.

Example

The following example uninstalls the workflow-mbean package that is installed on the CQ server with the IP address 10.36.79.223. The goal is executed using the followng command:

mvn content-package:uninstall
        

The following POM file is located in the current directory of the command line tool. The POM specifies the package name and the URL of the package service.

<project xmlns="http://maven.apache.org/POM/4.0.0" 
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
		xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.adobe.example</groupId>
  <artifactId>workflow-mbean</artifactId>
  <version>0.0.3-SNAPSHOT</version>
    <build>
        <plugins>
	    <plugin>
		<groupId>com.day.jcr.vault</groupId>
		<artifactId>content-package-maven-plugin</artifactId>
		<version>0.0.20</version>
		<configuration>
			<name>workflow-mbean</name>
			<failOnError>true</failOnError>
			<targetURL>http://10.36.79.223:4502/crx/packmgr/service.jsp</targetURL>
		</configuration>
	    </plugin>
	</plugins>
    </build>
</project>
        

package

Creates a content package. The default configuration of the package goal includes the contents of the directory where compiled files are saved. The execution of the package goal requires that the compile build phase has completed. The package goal is bound to the package phase of the Maven build lifecycle.

Parameters

In addition to the following parameters, see the description of the name parameter in the Common Parameters section.

Name Type Required Default Value Description
archive org.apache.maven.
archiver.
MavenArchiveConfiguration
No The archive configuration to use. See the documentation for Maven Archiver.
builtContentDirectory java.io.File Yes The value of the output directory of the Maven build. The directory that contains the content to include in package.
dependencies java.util.List No
embeddedTarget java.lang.String No
embeddeds java.util.List No
failOnMissingEmbed boolean Yes false A value of true causes the build to fail when an embedded artifact is not found in the project dependencies. A value offalse causes the build to ignore the error.
filterSource java.io.File No A file that specifies the source of the workspace filter. The filters specified in the configuration and injected via emebeds or subpackages are merged with the file content.
filters com.day.jcr.
vault.maven.pack.impl.
DefaultWorkspaceFilter
No Contains filter elements that define the package content. When executed, the filters are included in the filter.xml file. See the Using Filters section below.
finalName java.lang.String Yes The finalName defined in the Maven project (build phase). The name of the generated package ZIP file, without the .zip file extension.
group java.lang.String Yes The groupID defined in the Maven project. The groupId of the generated content package. This value is part of the target installation path for the content package.
outputDirectory java.io.File Yes The build directory defined in the Maven project. The local directory where the content package is saved.
prefix java.lang.String No
project org.apache.maven.
project.MavenProject
Yes The Maven project.
properties java.util.Map No Additional properties that you can set in the properties.xml file. These properties cannot overwrite the following predefined properties:
  • group: Use group parameter to set
  • name: Use name parameter to set
  • version: Use version parameter to set
  • description: Set from the project description
  • groupId: groupId of the Maven project descriptor
  • artifactId: artifactId of the Maven project descriptor
  • dependencies: Use dependencies parameter to set
  • createdBy: The value of the user.name system property
  • created: The current system time
  • requiresRoot: Use requiresRoot parameter to set
  • packagePath: Automatically generated from the group and package name
requiresRoot boolean Yes false Defines whether the package requires root. This will become the <code>requiresRoot</code> property of the properties.xml file.
subPackages java.util.List No
version java.lang.String Yes The version defined in the Maven project The version of the content package.
workDirectory java.io.File Yes The directory defined in the Maven project (build phase). The directory that contains the content to include in the package.

Using filters

Use the filters element to define the package content. The filters are added to the workspaceFilter element in the META-INF/vault/filter.xml file of the package.

The following filter example shows the XML structure to use:

<filter>
   <root>/apps/myapp</root>
   <mode>merge</mode> 
       <includes>
              <include>/apps/myapp/install/</include>
              <include>/apps/myapp/components</include>
       </includes>
       <excludes>
              <exclude>/apps/myapp/config/*</exclude>
       </excludes>
</filter>
        

Import mode

The mode element defines how content is the repository is affected when the package is imported. The following values can be used:

  • Merge: Content in the package that is not already in the repository is added. Content that is in both the package and the repository is unchanged. No content is removed from the repository. 
  • Replace: Content in the package that is not in the repository is added to the repository. Content in the repository is replaced with matching content in the package. Content is removed from the repository when it does not exist in the package.
  • Update: Content in the package that is not in the repository is added to the repository. Content in the repository is replaced with matching content in the package. No content is removed from the repository.  

When the filter contains no mode element, the default value of replace is used. 

Example

The following example creates a package that contains the workflow-mbean OSGi bundle. The POM file identifies the jcr_root directory as the value of the builtContentDirectory property. The jcr_root directory contains the bundle JAR file in the directory structure that mirrors the repository:

jcr_root/apps/myapp/install/workflow-mbean-0.03-SNAPSHOT.jar

Because the goal is bound to the package build phase, the following command executes the package goal:

mvn package
        
<project xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
    http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.adobe.example.myapp</groupId>
  <artifactId>workflow-mbean</artifactId>
  <version>0.0.3-SNAPSHOT</version>

  <build>
    <plugins>
      <plugin>
        <groupId>com.day.jcr.vault</groupId>
        <artifactId>content-package-maven-plugin</artifactId>
        <version>0.0.20</version>
        <configuration>
          <builtContentDirectory>jcr_root</builtContentDirectory>
          <targetURL>http://10.36.79.223:4502/crx/packmgr/service.jsp</targetURL>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>package</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
        

Instead of expressing the package goal in the plugin executions section, you can use content-package as the value of the project packaging element:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
    http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.adobe.example.myapp</groupId>
  <artifactId>workflow-mbean</artifactId>
  <version>0.0.3-SNAPSHOT</version>
  <packaging>content-package</packaging>
  <build>
    <plugins>
      <plugin>
        <groupId>com.day.jcr.vault</groupId>
        <artifactId>content-package-maven-plugin</artifactId>
        <version>0.0.20</version>
        <configuration>
          <builtContentDirectory>jcr_root</builtContentDirectory>
          <targetURL>http://10.36.79.223:4502/crx/packmgr/service.jsp</targetURL>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
        

help

Parameters

Name Type Required Default Value Description
detail boolean No false Determines whether to display all settable properties for each goal. A value of true displays all settable properties.
goal String No The name of the goal for which to show help. If no value is specified, help for all goals is displayed.
indentSize int No 2 The number of spaces to use for the indentation of each level. If you specify a value, the value should be positive.
lineLength int No 80 The maximum length of a display line. If you specify a value, the value should be positive.

Obtaining the Content Package Maven Plugin

The plugin is available from the public Adobe repository. To download the plugin, add the following Maven profile to your Maven settings file and activate it. When you use a Maven command, the plugin is downloaded to your local repository if needed.

Note: The Adobe Public Releases repository is not browsable, so that navigating to the repository URL using your web browser results in a Not Found error. However, Maven is able to access the repository directories.

 

<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>
        

Embedding OSGi Bundles in a Content Package

Use the Content Package Maven Plugin to embed OSGi bundles into the content package. To embed the bundle, implement the following configurations:

  • The bundle must be declared as a dependency of the Maven project.
  • The plugin configuration references the bundle using the desired path of the bundle in the package.

The following example POM creates a package that contains the Apache Sling JCR UserManager bundle. In the package, the bundle JAR is located in the jcr_root/apps/myapp/install folder:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
             http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
  	<groupId>com.adobe.example.myapp</groupId>
	<artifactId>embedded-example</artifactId>
	<packaging>content-package</packaging>
	<version>1.0.0-SNAPSHOT</version>

   <build>
	<plugins>
	    <plugin>
	       <groupId>com.day.jcr.vault</groupId>
		    <artifactId>content-package-maven-plugin</artifactId>
		    <version>0.0.20</version>
		    <extensions>true</extensions>
		    <configuration>
			<filters>
			    <filter>
				<root>/apps/myapp</root>
			    </filter>
			 </filters>
			 <embeddeds>
			    <embedded>
				<groupId>org.apache.sling</groupId>
				<artifactId>org.apache.sling.jcr.jackrabbit.usermanager</artifactId>
				<target>/apps/myproject/install</target>
			     </embedded>
			 </embeddeds>
		     </configuration>
		</plugin>	
	   </plugins>
    </build>
    <dependencies>
	<dependency>
	     <groupId>org.apache.sling</groupId>
	     <artifactId>org.apache.sling.jcr.jackrabbit.usermanager</artifactId>
	     <version>2.2.0</version>
	</dependency>
    </dependencies>	
</project>

        

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 and Package Share.

In the package, FileVault-specific files are located in the /META-INF/vault folder. 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 etc.) -->
        <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 Archetypes To Generate CQ Projects

Several Maven archetypes are available for generating CQ projects. Use the archetype that corresponds with your development goals:

Note

The Apache Sling project also offers archetypes useful in CQ development. These are documented at http://sling.apache.org/site/maven-archetypes.html.

Each archetype generates the following items:

  • The project folder structure.
  • POM files.
  • FileVault configuration files. 

Archetype artifacts are available from the Adobe public Maven repository. To download and execute an archetype, identify the archetype and the Adobe repository using the parameters of the Maven archetype:generate command:

mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault \
-DarchetypeArtifactId={id_of_archetype} -DarchetypeVersion=1.0.2 \
-DarchetypeRepository=adobe-public-releases
        

The Maven archetype plugin uses interactive mode in the shell or command prompt to collect information about your project. The information that you provide is used to configure various project properties, such as folder names and artifact ID's.

POM files

The generated POM files include commands for compiling code, creating bundles, and deploying them to CQ in packages. The groupID, artifactId, version, and name properties of the Maven project are automatically populated using the values that you provide to the Maven archetype:generate interactive prompt.

You may want to change the the following default values in the generated pom.xml file:

  • The CQ server name or IP address: The default value is localhost. The crx.host element below project/properties contains this value.
  • The port number for the CQ server: The default value is 4502. The crx.port element below project/properties contains this value.
  • The version of Content Package Maven Plugin: Use the latest version as the content of the version element for the plugin with artifactId of content-package-maven-plugin.  The default value is 0.0.20.

Using the archetypes

  1. In a shell window or command prompt, enter the Maven archetype:generate command. When prompted, provide values for the remaining parameters.

    For information about each parameter, refer to the section for the archetype that you are using.

  2. Use a text editor to open the pom.xml file and edit default values according to your requriements.
  3. Populate the generated folders with resources.
  4. Enter the mvn clean install command. 

simple-content-package-archetype

Creates a maven project that is suitable for installing resources for a simple CQ application. The folder structure is that used below the /apps folder of the CQ repository. The POM defines commands for packaging the resources that you place in the folders and installing the packages on the CQ server.

Archetype artifact properties:

  • Group ID: com.day.jcr.vault
  • Artifact ID: simple-content-package-archetype
  • Version: 1.0.2
  • Repository: adobe-public-releases

Maven command:

mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault \
-DarchetypeArtifactId=simple-content-package-archetype \
-DarchetypeVersion=1.0.2 \
-DarchetypeRepository=adobe-public-releases
        

Archetype parameters:

  • groupId: The groupId of the content package that Maven generates. The value is autoatically used in the POM file. 
  • artifactId: The name of the content package. The value is also used as the name of the project folder.
  • version: The version of the content package.
  • package: This value is not used for simple-content-package-archetype.
  • appsFolderName: The name of the folder below /apps. 
  • artifactName: The description of the content package.  
  • packageGroup: The name of the content package group. This value configures the group parameter for the Package goal of the Content Package Maven Plugin.

Folder structure:

${artifactId}
   |- pom.xml
   |- README.txt
   |- src
      |- main
         |- content
             |- jcr_root
                 |- apps
                     |- ${appsFolderName}
                            |- components 
                               |- .content.xml
                            |- config
                            |- install
             |- META-INF
                 |- vault
                     |- config.xml
                     |- filter.xml
                     |- nodetypes.cnd
                     |- properties.xml
                     |- definition
                        |- .content.xml
        

simple-content-package-with-embedded-archetype

Performs the same tasks as the simple-content-package-archetype, and also downloads and includes an artifact from a public Maven repository. 

Archetype bundle properties:

  • Group ID: com.day.jcr.vault
  • Artifact ID: simple-content-package-with-embedded-archetype
  • Version: 1.0.2
  • Repository: adobe-public-releases

Maven command:

mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault \
-DarchetypeArtifactId=simple-content-package-with-embedded-archetype \
-DarchetypeVersion=1.0.2 \
-DarchetypeRepository=adobe-public-releases
        

Archetype parameters:

  • groupId: The groupId of the content package that Maven generates. The value is autoatically used in the POM file. 
  • artifactId: The name of the content package. The value is also used as the name of the project folder.
  • version: The version of the content package.
  • package: This parameter is not used.
  • appsFolderName: The name of the folder below /apps. 
  • artifactName: The description of the content package.  
  • embeddedArtifactId: The ID of the artifact to embed in the content package.
  • embeddedGroupId: The group ID of the artifact to embed.
  • embeddedVersion: The version of the artifact to embed.
  • packageGroup: The name of the content package group. This value configures the group parameter for the Package goal of the Content Package Maven Plugin.

Folder structure:

${artifactId}
   |- pom.xml
   |- README.txt
   |- src
      |- main
         |- content
             |- jcr_root
                 |- apps
                     |- ${appsFolderName}
                            |- components 
                            |- config
                            |- install
             |- META-INF
                 |- vault
                     |- config.xml
                     |- filter.xml
                     |- nodetypes.cnd
                     |- properties.xml
                     |- definition
        

multimodule-content-package-archetype

Creates a maven project that includes the folder structure for developing a CQ application and installing resources to the server.

The bundle folder contains the folder structure that stores the Java and JUnit source files that you develop. The pom.xml file in this folder creates the OSGi bundle. The following values in the POM identify the artifact and the bundle:

  • artifactID: ${artifactID}-bundle
  • Bundle-SymbolicName: ${groupId}.${artifactId}-bundle.

${artifactID} and  ${groupId} are the values that you provide for these parameters when executing the archetypes.

The content folder contains the resources that are installed to the CQ server. The value of artifactID is  ${artifactID}multimodule-bundle

The parent folder contains the parent POM that manages Maven plugins and dependencies. 

Archetype bundle properties:

  • Group ID: com.day.jcr.vault
  • Artifact ID: multimodule-content-package-archetype
  • Version: 1.0.2
  • Repository: adobe-public-releases

Maven command:

mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault \
-DarchetypeArtifactId=multimodule-content-package-archetype \
-DarchetypeVersion=1.0.2 \
-DarchetypeRepository=adobe-public-releases
        

Archetype parameters:

  • groupId: The groupId of the content package that Maven generates. The value is autoatically used in the POM file. 
  • artifactId: The name of the content package. The value is also used as the name of the project folder.
  • version: The version of the content package.
  • package: This value is not used for multimodule-content-package-archetype.
  • appsFolderName: The name of the folder below /apps. 
  • artifactName: The description of the content package.  
  • packageGroup: The name of the content package group. This value configures the group parameter for the Package goal of the Content Package Maven Plugin.

Folder structure:

${artifactId}
   |- pom.xml
   |- bundle
      |- pom.xml
      |- src
         |- main
            |- java
               |- ${groupId}
                  |- SimpleDSComponent.java
         |- test
            |- java
               |- ${groupId}
                  |- SimpleUnitTest.java
   |- content
      |- pom.xml
      |- src
         |- main
            |- content
               |- jcr_root
                  |- apps
                     |- ${appsFolderName} 
                            |- config
                            |- install
                  |- META-INF
                      |- vault
                         |- config.xml
                         |- filter.xml
                         |- nodetypes.cnd
                         |- properties.xml
                         |- definition
                            |- .content.xml
        

Your comments are welcome!
Did you notice a way we could improve the documentation on this page?
Please leave your comments below and we will make the appropriate changes.

COMMENTS

  • By Manish Bellani - 4:26 PM on Feb 18, 2013   Reply
    Hello,

    We've recently started using CQ in our organization and still figuring out the deployment model for it. Is there a way to support multiple target urls from the maven plugin, ideally you would want to deploy the app on multiple instances in the qa or production environments. although its possible to execute the install goal multiple times it would really be nice if the plugin supported list of comma separated urls.

    Manish
    • By ppiegaze - 3:00 PM on Feb 26, 2013   Reply
      Unfortunately, currently there is no multiple target URL option in the plugin.
      • By dc - 9:09 PM on Mar 19, 2013   Reply
        The Sling archetypes are also useful: http://sling.apache.org/site/maven-archetypes.html
        • By ppc13 - 8:32 PM on Apr 11, 2013   Reply
          The multi-module archetype refuses to install to a local instance because the JAR is not an OSGI bundle.

          [INFO] C:\testproject\testproject\content\target\testproject-content-1.0-SNAPSHOT.jar is not an OSGi Bundle, not uploading

          How can this be resolved?
          • By zumbrunn - 9:41 AM on Apr 13, 2013   Reply
            Hi ppc13, maybe somebody on the AEM forums will be able to help you with that: http://forums.adobe.com/community/digital_marketing_suite/cq5
            • By ppc13 - 7:43 PM on Apr 17, 2013   Reply
              It appears I was using the incorrect target, using -autoInstallPackage instead of -autoInstallBundle worked.
              • By Guillaume Carlino - 6:11 AM on Apr 18, 2013   Reply
                Hi

                We are glad to know that you figured out your issue.
                Thanks for your feedback.
                Guillaume
          • By wqeywerwe wewewewe - 10:08 AM on Jun 07, 2013   Reply
            The instructions state: "To download the plugin, add the following Maven profile to your Maven settings file and activate it". To activate the profile, add the following after the profiles section:
            <activeProfiles>
            <activeProfile>adobe-public</activeProfile>
            </activeProfiles>
            • By Swaminathan GR - 3:14 PM on Jul 02, 2013   Reply
              I have not been able to connect to the adobe repositories mentioned above for the past few days. can somebody tell me if it is temporary or has been closed permanently?
              • By Alexandre COLLIGNON - 10:09 AM on Jul 08, 2013   Reply
                Hi Swaminathan GR,
                The Adobe Maven Repositories service is available again since July 3rd.
                Cheers,
                Alexandre
              • By Thomas - 8:31 AM on Jul 15, 2013   Reply
                I'm trying to create a custom archetype based on the multimodule archetype described here. Is the source code for the archetype available somewhere to build from it, or do I need to start from scratch?

                Until now I used the "maven-vault-plugin" for packaging and installing on the server. In the archetype the "content-package-maven-plugin" is used. I didn't find proper documentation for it, so what are the possible execution ids? I would like to separate the packaging and install into two profiles, which could be chained if necessary.
                In the "maven-vault-plugin" these were "create-package" and "install-package". What are the equivalents?
                • By Alexandre COLLIGNON - 1:19 PM on Jul 17, 2013   Reply
                  Hi Thomas,

                  > Is the source code for the archetype available somewhere ?

                  No, we do not provide the source code of this archetype (at the moment) but you might be interested in the archetypes provided by sling [0] which are open source. These archetypes might help you to build a custom one.

                  > In the archetype the "content-package-maven-plugin" is used.
                  > I didn't find proper documentation for it, so what are the possible execution ids?

                  Please refer to the output of mvn content-package:help which contains all the available goals.

                  > In the "maven-vault-plugin" these were "create-package" and "install-package". What are the equivalents?

                  mvn package creates a content-package if the packaging type of your project is content-package
                  Note that you can also use mvn content-package:package.

                  mvn content-package:install installs the current package on any CQ instance (according to the configuration).

                  Hope that helps, Alex.

                  [0] https://sling.apache.org/site/maven-archetypes.html
                • By Grzegorz Bogdanowicz - 3:41 PM on Sep 02, 2013   Reply
                  Hi,

                  I cannot find com.day.jcr.vault:content-package-maven-plugin:0.0.20 in http://repo.adobe.com/nexus/content/groups/public. In fact all previous versions are also gone.
                  Is it some kind of issue or are they moved to the different repo?

                  Regards,
                  Grzegorz
                  • By Alexandre COLLIGNON - 2:59 PM on Sep 03, 2013   Reply
                    Hi Grzegorz,
                    Thanks for your comment. I am logging the issue and will get back to you as soon as possible.
                    Alexandre
                    • By Alexandre COLLIGNON - 12:59 PM on Sep 04, 2013   Reply
                      Hi Grzegorz,
                      We have fixed this issue. The content-package-maven-plugin is available again.
                      Alex.
                    • By David - 5:40 PM on Sep 06, 2013   Reply
                      Two of the maven archetypes, simple-content-package-archetype and simple-content-package-with-embedded-archetype, are no long on the nexus repository.
                      • By Staff - 2:31 PM on Sep 12, 2013   Reply
                        We have opened a bug for this issue. Thanks for bringing it to our attention.
                      • By sanjeev kumar - 12:36 PM on Sep 19, 2013   Reply
                        Hi,

                        I am using this plugin with rm goal. The plugin behaves strangely for the fact that sometimes it fails with error :

                        DEBUG] Configuring mojo 'com.day.jcr.vault:content-package-maven-plugin:0.0.20:rm' with basic configurator -->
                        [DEBUG] (f) failOnError = true
                        [DEBUG] (f) name = <package_name>
                        [DEBUG] (f) password = ********
                        [DEBUG] (f) serviceURL = http://localhost:4502/crx/packmgr/service/.json
                        [DEBUG] (f) settings = org.apache.maven.execution.SettingsAdapter@5f65d905
                        [DEBUG] (f) targetURL = <some_url>/crx/packmgr/service.jsp
                        [DEBUG] (f) timeout = 5
                        [DEBUG] (f) useProxy = true
                        [DEBUG] (f) userId = ********
                        [DEBUG] (f) verbose = false
                        [DEBUG] -- end configuration --
                        [DEBUG] Proxying disabled (useProxy=true) or no proxies configured
                        [ERROR] Request to <some_url>/crx/packmgr/service.jsp failed, response=Created
                        [INFO] ------------------------------------------------------------------------
                        [INFO] BUILD FAILURE

                        I am really not able to figure out, what the issue can be. I tried defining the 'timeOut' value explicitly to 10 but to no avail. Can you please help?
                        Other goals like uninstall and install work just fine. Facing issue with the rm goal. I am using version 0.0.20

                        Thanks in advance
                        • By alvawb - 6:43 PM on Sep 19, 2013   Reply
                          Please post your question along with this error log to our user forum at http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.html.
                          • By sanjeev kumar - 8:31 AM on Sep 20, 2013   Reply
                            Thanks for your rep @alvawb. Posted a question on the link provided by you.
                        • By Dan Brandt - 8:27 PM on Sep 24, 2013   Reply
                          I've found the maven plugin to be very very handy. I have one suggested improvement.

                          It would be really nice if the content-package-maven-plugin would provide the ability to 'replicate' the package as well.
                          • By Deepankar - 10:02 AM on Oct 24, 2013   Reply
                            I second you Dan. The plugin will become much powerful if it has the option of replicating the package.
                            • By Ove Lindström - 10:25 AM on Dec 06, 2013   Reply
                              It actually already does, but I don't know why it isn't documented at this page. But if you type "mvn content-package:help" you will find the goal 'replicate' there to.

                              The command:
                              mvn content-package:help -Ddetail=true -Dgoal=replicate
                              gives you the full details of the replication goal.
                          • By Deepankar - 10:00 AM on Oct 24, 2013   Reply
                            I am not able to download the plugin from the nexus repository. I am getting a connection time out error. Is the repository down?
                            • By Scott Brodersen - 8:11 PM on Oct 24, 2013   Reply
                              The repository seems ok now.
                            • By Carl - 11:13 AM on Oct 24, 2013   Reply
                              I too can't access the repo - has it been taken down and do you know when it will be available?
                              • By Scott Brodersen - 8:12 PM on Oct 24, 2013   Reply
                                The repo seems to be available now.
                              • By Alvin - 3:18 AM on Nov 13, 2013   Reply
                                Hi, I'm trying to connect to http://repo.adobe.com/nexus/content/groups/public from our company's Nexus. However, even after adding it to our "public repo", it still could not load the jar files from Adobe repo. If I browse remotely, it seems to be okay.
                                • By alvawb - 3:59 PM on Nov 13, 2013   Reply
                                  I am able to reach the repo from our corporate environment. I'm not sure how your corporate network is set up. You may need to contact your IT department to determine what the issue might be (firewall?).
                                • By Bryan - 7:11 PM on Dec 11, 2013   Reply
                                  Can we get this documentation updated to version *.23; esp for content-package:download?
                                  • By alvawb - 8:21 PM on Dec 19, 2013   Reply
                                    Thanks for your feedback. I've opened an issue to get this updated.
                                  • By Sivaram Iyer - 12:48 AM on Mar 20, 2014   Reply
                                    I have the plugin configured like below :

                                    <plugin>
                                    <groupId>com.day.jcr.vault</groupId>
                                    <artifactId>content-package-maven-plugin</artifactId>
                                    <version>0.0.20</version>
                                    <configuration>
                                    <failOnError>true</failOnError>
                                    <name>core-app</name>
                                    <targetURL>http://localhost:4502/crx/packmgr/service.jsp</targetURL>
                                    </configuration>
                                    </plugin>

                                    when i try to uninstall using: mvn content-package:uninstall

                                    I get :

                                    [INFO] --- content-package-maven-plugin:0.0.20:uninstall (default-cli) @ core ---
                                    [ERROR] Request failed: java.lang.IllegalArgumentException: Several packages with name 'core-app' exist. Please specify group. (500)

                                    How can I specify a group for this configuration? It is NOT specified in the documetnation above.

                                    Best,
                                    Siv

                                    • By aheimoz - 8:49 AM on Mar 21, 2014   Reply
                                      For specific scenarios such as yours, please ask questions on our forum:
                                      - http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.html
                                      You will reach a wider audience and receive a greater response.
                                      Hope that helps.

                                    ADD A COMMENT

                                     

                                    In order to post a comment, you need to sign-in.

                                    Note: Customers with DayCare user accounts need to create a new account for use on day.com.

                                    ***