Dependent add-on is not getting installed unless Java class is referenced in add-on code

The dependent add-on is not getting installed unless Java class is referenced in add-on code
When we install OBR with multiple add-on dependencies, the dependent add-on is not getting installed and not getting added to MANIFEST.MF unless at least one Java class is used in the current add-on code where other plugins are added as a dependency.

Please post parts of your pom (the configuration of the confluence-maven-plugin and osgi instructions) and let us know if you use Atlassian Spring Scanner (and in which version).

I am not using Spring Scanner. Find below the pom.xml entry.

             <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-confluence-plugin</artifactId>
                <version>6.3.18</version>
                <extensions>true</extensions>
                <configuration>
                	<extractDependencies>false</extractDependencies>
                    <compressResources>false</compressResources>
                    <productVersion>6.0.1</productVersion>
                    <enableQuickReload>true</enableQuickReload>
                    <enableFastdev>false</enableFastdev>
                    <pluginDependencies>
                        <pluginDependency>
                            <groupId>my.confluence.plugin</groupId>
                            <artifactId>common-plugin</artifactId>
                        </pluginDependency>
                    </pluginDependencies>
                    <instructions>
                        <Import-Package>
                        *;version="0";resolution:=optional
                        </Import-Package>
                        <CONF_COMM/>
                    </instructions>
                </configuration>
            </plugin>

When not using Spring Scanner, I recall this is the normal behaviour. It will generate the Manifest scanning your code and creating OSGi dependencies from that.

Try to include a package dependency into your OSGi instructions:

<Import-Package>
       com.common-plugin.package.*,

Maybe you also need to add a version.
This should work, but the transformation process is brittle and does not yield consistent results. I absolutely encourage you to use Spring Scanner; it gives you faster installs and stable manifests at the expense of some fiddling at the beginning.

2 Likes

Thanks @christoffer for your suggestion, I tried to add the package in pom.xml under <Import-Package>, it does not work either. I will try to add Spring Scanner capability but it requires more changes.