Expand my Community achievements bar.

SOLVED

GroupID missing from Bundle Symbolic name

Avatar

Community Advisor

Hello,

 

We have refractured legacy code as per the Archetype 48. In the latest code, groupID is missing from Bundle Symbolic name. Only Artifact ID is used in Symbolic Name.

What could we be missing? Please suggest.


Aanchal Sikka

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@arunpatidar @BrianKasingli 

 

I received following response from Adobe. Thought of sharing, if anyone refers to the thread in future

 

"To address your query about which Maven plugin is recommended by Adobe for handling OSGi bundles in AEM projects, let's look into the details of both plugins you mentioned: "bnd-maven-plugin" and "maven-bundle-plugin".

 

bnd-maven-plugin: The bnd-maven-plugin is used to build OSGi bundles and manage their metadata. This plugin is known for its flexibility and ability to handle complex OSGi requirements. It allows for detailed control over the OSGi manifest and is often used in projects that need advanced configurations.

 

maven-bundle-plugin: The maven-bundle-plugin is provided by Apache Felix and is specifically designed for building OSGi bundles. It simplifies the process of generating OSGi-compliant JAR files and is widely used in the AEM community. This plugin is known for its ease of use and integration with Maven projects.

 

Based on the best practices, the "maven-bundle-plugin" is generally recommended for use in AEM projects. This plugin is specifically tailored for building OSGi bundles and integrates seamlessly with the AEM development workflow."


Aanchal Sikka

View solution in original post

9 Replies

Avatar

Community Advisor

@aanchal-sikka, can you take a closer look at the...

<executions>
                        <execution>
                            <id>bnd-process</id>
                            <goals>
                                <goal>bnd-process</goal>
                            </goals>
                            <configuration>
                                <bnd><![CDATA[
Bundle-Category: ${componentGroupName}

Take a look how WKND is doing it, https://github.com/adobe/aem-guides-wknd/blob/main/pom.xml#L221

 

Avatar

Community Advisor

Hi @aanchal-sikka 
We are using latest archtype since beginning , so only had artifacid in bundle name, but the settings are in the core POM files.

Example:

 

 

arunpatidar_0-1722497912300.png

 



Arun Patidar

Avatar

Community Advisor

@arunpatidar 

Thanks for cross-checking. I thought the same thing initially.

Then realized, that OOTB core pom.xml is inheriting <groudID> from parent pom, but still... Not part of symbolic name

 

Also, tried placing it in core/pom.xml. But, no luck

 

 


Aanchal Sikka

Avatar

Community Advisor

Hi @aanchal-sikka 
The Bundle-SymbolicName header can be set by the user. The default is the name of the main bnd file, or if the main bnd file is called bnd.bnd, it will be the name of the directory of the bnd file. An interesting variable is ${project} that will be set to this default name.

https://bnd.bndtools.org/chapters/800-headers.html 

 

You can try to set symbolic name explicitly if that helps.



Arun Patidar

Avatar

Administrator

@aanchal-sikka Did you find the suggestions from users helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni

Avatar

Community Advisor

@arunpatidar @BrianKasingli  Thanks for the inputs.

 

Just observed that its caused by following plugin. Its the default plugin in latest archtypes

<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd><![CDATA[
Import-Package: javax.annotation;version=0.0.0,*
]]></bnd>
</configuration>
</execution>
</executions>
</plugin>


If we replace this by the old maven-bundle-plugin, the Symbolic name resolves as groupID.artifactID

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<!-- Import any version of javax.inject, to allow running on multiple
versions of AEM -->
<Import-Package>javax.inject;version=0.0.0,*</Import-Package>
<Sling-Model-Packages>
com.mdlz.damui.core
</Sling-Model-Packages>
</instructions>
</configuration>
</plugin>


One thing to note is, these 2 bundles are considered different by OSGi.

In general, all bundles in AEM follow groupId.ArctifactID, but the latest plugin uses only artifact ID. Checking with Adobe on the recommended way.

If you have any suggestions, please share.


Aanchal Sikka

Avatar

Community Advisor

Hi @aanchal-sikka 

 

The bnd-maven-plugin is the preferred choice for declaring bundle configurations because it is more modern and efficient.

  • The bnd-maven-plugin is the direct tool for managing OSGi bundles, providing more direct control and updated features.
  • The maven-bundle-plugin relies on the bnd-maven-plugin under the hood, meaning that using the bnd-maven-plugin directly can simplify your build configuration and potentially avoid indirect issues.

By opting for the bnd-maven-plugin, you are using the latest and most direct method for bundle configuration, ensuring better support and updates.

 

https://github.com/adobe/aem-project-archetype/issues/172 



Arun Patidar

Avatar

Correct answer by
Community Advisor

@arunpatidar @BrianKasingli 

 

I received following response from Adobe. Thought of sharing, if anyone refers to the thread in future

 

"To address your query about which Maven plugin is recommended by Adobe for handling OSGi bundles in AEM projects, let's look into the details of both plugins you mentioned: "bnd-maven-plugin" and "maven-bundle-plugin".

 

bnd-maven-plugin: The bnd-maven-plugin is used to build OSGi bundles and manage their metadata. This plugin is known for its flexibility and ability to handle complex OSGi requirements. It allows for detailed control over the OSGi manifest and is often used in projects that need advanced configurations.

 

maven-bundle-plugin: The maven-bundle-plugin is provided by Apache Felix and is specifically designed for building OSGi bundles. It simplifies the process of generating OSGi-compliant JAR files and is widely used in the AEM community. This plugin is known for its ease of use and integration with Maven projects.

 

Based on the best practices, the "maven-bundle-plugin" is generally recommended for use in AEM projects. This plugin is specifically tailored for building OSGi bundles and integrates seamlessly with the AEM development workflow."


Aanchal Sikka