Created
May 5, 2023 23:35
-
-
Save TitusRobyK/f35bc1102abb368823b64dd3baa311eb to your computer and use it in GitHub Desktop.
Create a AEM CRX Package using Groovy for a list of paths
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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