How to create a package filter that uninstalls old bundle and installs the newer one


To create a package that installs a new version of an OSGi bundle and deletes the older version, you can use a filter like this:

<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
    <filter root="/apps/myapp/install">
        <exclude pattern="/apps/myapp/install/.*"/>
        <include pattern="/apps/myapp/install/custombundle-.*"/>

Here's an example scenario for the filter above:

  1. Create a package using the filter above, the package should only contain one file /apps/myapp/install/custombundle-2.0.0.jar
  2. When you upload and install the package, AEM already has the older version installed /apps/myapp/install/custombundle-1.0.0.jar.
  3. When the package is installed, it deletes /apps/myapp/install/custombundle-1.0.0.jar and install /apps/myapp/install/custombundle-2.0.0.jar instead without affecting any other files under /apps/myapp/install.
Adobe logo

Sign in to your account