GroupID missing from Bundle Symbolic name | Community
Skip to main content
aanchal-sikka
Community Advisor
Community Advisor
August 1, 2024
Solved

GroupID missing from Bundle Symbolic name

  • August 1, 2024
  • 5 replies
  • 2218 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by aanchal-sikka

@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."

5 replies

BrianKasingli
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
August 1, 2024

@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

 

arunpatidar
Community Advisor
Community Advisor
August 1, 2024

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:

 

 

 

Arun Patidar
aanchal-sikka
Community Advisor
Community Advisor
August 1, 2024

@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
arunpatidar
Community Advisor
Community Advisor
August 1, 2024

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
kautuk_sahni
Community Manager
Community Manager
August 1, 2024

@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
aanchal-sikka
Community Advisor
Community Advisor
August 4, 2024

@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
arunpatidar
Community Advisor
Community Advisor
August 5, 2024

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
aanchal-sikka
Community Advisor
Community Advisor
August 5, 2024

Thanks for sharing the link and details @arunpatidar 

Aanchal Sikka
aanchal-sikka
Community Advisor
aanchal-sikkaCommunity AdvisorAuthorAccepted solution
Community Advisor
August 11, 2024

@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