Search code examples
javamavenosgimaven-pluginday-cq

Creating OSGi bundles with different services


We are using Adobe Day CQ for our deployment. We are currently creating OSGi bundles with gets deployed in CQ with all the services using maven-bundle-plugin.

Now we have a scenario where we do not want some services to get enabled in Publish instance but should be enabled in Author.

Is there a way where we can manage two bundles one for author with the services required for author and one for publish which are required on publish, using the same pom.xml ?
Or else is there any other way by which this thing can me managed.
Please help me in this regard. We are right now using this for creating bundles:

<plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>2.0.1</version>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Import-Package>
                        org.osgi.framework,
                        *;resolution:=optional
                    </Import-Package>
                    <Export-Package>
                          com.abc.platform.enow.aem.core.testing.*,
                        com.abc.platform.enow.aem.core.utils.*,
                    com.abc.platform.enow.aem.core.viewhelper.*,
                        com.abc.platform.enow.aem.core.search.*

                    </Export-Package>
                </instructions>
            </configuration>
</plugin>

Solution

  • We have achieved this by using the runmode property for CQ. We did the below:

    • Created the full build.
    • In the distribution phase we pushed the jar (that we required to install only on author) to the folder /apps/"project_name"/install.author.
    • Here "author" is the run mode for the instance.
    • This jar deploys to both author and publish in the folder install.author but in installed / reflected only on the author mode.

    Thanks for the reply, but we found this solution more flexible and feasible.

    Regards, Vaibhav