How to build a package from an XPath query without installing any tools to the AEM instance


AEM 6.x


The instructions below must be run on Mac OS, Linux, or Windows (on Cygwin) with cURL, Python and Java SDK installed:

  1. Go to http://src-aem-host:port/crx/packmgr/index.jsp and log in as admin.

  2. Create a package named "ACL-migration"

  3. Click the Edit button.

  4. Select the Advanced tab and set AC Handling mode to Merge.

  5. Save.

  6. Build the package and download it.

  7. On the file system run this command on the package to extract the META-INF/vault/filter.xml file:

    jar -xvf META-INF/vault/filter.xml

  8. In the same directory, run this command to download a json file of the ACL paths from the source instance.  Set the username and password and correct host and replace the xpath query /jcr:root/content//element(*,rep:ACL) with your own):

    curl -u admin:admin 'http://aemhost/crx/de/query.jsp?' -G --data '_dc=1507011481908&_charset_=utf-8&type=xpath&stmt=/jcr:root/content//element(*,rep:ACL)&showResults=true' > data.json

  9. Create a file and paste the python code below inside it:

  10. Run the python script from the same folder where data.json was created and save the output to META-INF/vault/filter.xml (replacing the existing contents of filter.xml):

    python > META-INF/vault/filter.xml

    import json
    from pprint import pprint
    with open('data.json') as data_file:
        data = json.load(data_file)
    print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
    print("<workspaceFilter version=\"1.0\">")
    for item in data["results"]:
        print("<filter root=\"{}\"/>".format(item["path"]))
  11. Use this command to update the filter.xml within the zip file:

    jar -uvf META-INF/vault/filter.xml

  12. Upload the zip file to the source instance package manager: http://src-aem-host:port/crx/packmgr/index.jsp

  13. Click Build or Rebuild to build the package.

  14. Download the package from the source AEM server.

  15. Upload the package to the destination AEM server's package manager: http://dst-aem-host:port/crx/packmgr/index.jsp

  16. Click Install to install it.




Adobe MAX 2024

Adobe MAX

10 月 14 至 16 日邁阿密海灘和線上

Adobe MAX


10 月 14 至 16 日邁阿密海灘和線上

Adobe MAX 2024

Adobe MAX

10 月 14 至 16 日邁阿密海灘和線上

Adobe MAX


10 月 14 至 16 日邁阿密海灘和線上