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.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy