Skip to content

Instantly share code, notes, and snippets.

@TitusRobyK
Created May 5, 2023 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TitusRobyK/f35bc1102abb368823b64dd3baa311eb to your computer and use it in GitHub Desktop.
Save TitusRobyK/f35bc1102abb368823b64dd3baa311eb to your computer and use it in GitHub Desktop.
Create a AEM CRX Package using Groovy for a list of paths
/*
In the Data Section , add the paths as shown below
/content/abc
/content/xyz
/content/qwerty/mno/pwse
Upon execution of the following code , This would create a package called "Sample-Package" with the above paths as filters.
*/
import com.adobe.acs.commons.packaging.PackageHelper.ConflictResolution
import java.text.SimpleDateFormat
String packageGroup ="package-group";
String packageName ="Sample-Package";
String[] paths = data.split("\n");
List<String> inputPathList = Arrays.asList(paths);
def packageHelper = getService("com.adobe.acs.commons.packaging.PackageHelper")
packageHelper.createPackageForPaths(
inputPathList ?: [],
session,
packageGroup,
packageName,
null ?: new SimpleDateFormat("yyyy-MM-dd").format(new Date()),
ConflictResolution.valueOf(null ?: "None"),
null ?: [:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment