Embed Third party dependency using bnd-maven-plugin
This post explains the use of bnd-maven-plugin to embed third party dependency
Two main instructions of bnd-maven-plugin that serves the purpose are detailed below.
- -conditionalpackage
- pick packages from respective library and copy them in the bundle. Any dependencies of those copied packages will also be copied if they match the selectors.
- This means we need to explicitly list all the Java package names of desired dependency as part of this instruction (including its transitive dependencies)
- More about conditionalpackage instruction from official docs - https://bnd.bndtools.org/instructions/conditionalpackage.html
- -includeresource
- For including resource inline
- -includeresource: @artifactId-version.jar!/*
- For embedding as a jar with an entry in bundle class path
- -includeresource: artifactId-version.jar;lib:=true
- For several other possible combinations for including the resource, please check - https://bnd.bndtools.org/instructions/includeresource.html
With complete understanding on these two instructions from official docs + based on how we would like the dependency to be included, we can use any one of the instruction with its respective options accordingly.
Sample plugin entry for the dependency jackson-dataformat-csv (Supports reading and writing CSV)
where ${jackson-dataformat-csv.version} in the instruction resolves to a maven property holding the artifact version (2.9.5) as defined in parent pom.xml.
- conditionalpackage
- includeresource inline
- includeresource embed (as a jar with class path entry)
Other blog posts for embedding third party dependency using maven-bundle-plugin,
Description: Experience a realm of unmatched comfort and luxury with the best rooms in Nagercoil at Hotel Vijayetha. Immerse yourself in a world where modern elegance meets warm hospitality, creating a haven for discerning travelers seeking the epitome of accommodation.
ReplyDeleteOur best rooms are thoughtfully designed to provide a tranquil retreat for both business and leisure guests. From intimate singles to spacious suites, each room is adorned with tasteful decor, contemporary furnishings, and premium amenities to ensure a restful sanctuary.
Indulge in a culinary journey at our on-site restaurant, offering exquisite flavors and culinary delights. The central location of Hotel Vijayetha provides easy access to local attractions, business centers, and transportation hubs, making it the ideal choice for those seeking convenience and style.
Unwind in the plush surroundings, relish the warmth of attentive staff, and enjoy the convenience of modern amenities such as high-speed Wi-Fi and well-appointed bathrooms. Hotel Vijayetha's commitment to excellence guarantees that your stay in Nagercoil is marked by comfort, style, and an unparalleled level of service.
Book the best rooms in Nagercoil at Hotel Vijayetha and elevate your travel experience to new heights. Whether you're on a business trip or exploring the city's cultural gems, our best rooms redefine the meaning of luxury and ensure a memorable stay..visit us on https://www.hotelvijayetha.com/our-rooms/.!!!
Great guide! I was struggling to understand how to use the bnd-maven-plugin for third-party dependencies. This made things much clearer.
ReplyDeleteSnacks Distributorship
Fume Scrubber manufacturers
Can you explain the difference between Embed-Dependency and Include-Resource in bnd-maven-plugin? I’m a bit confused.
ReplyDeleteWarehouse Rack in India
Industrial rack manufacturer in Noida
Thanks for this! I didn’t know you could handle dependencies this way with Maven. This will be really helpful for my project.
ReplyDeleteManual Dust Collector Delhi
Centrifugal Blower in delhi
Quick question: Does embedding dependencies increase the JAR size significantly? Wondering about the trade-offs here.
ReplyDeletetunnel ventilation system
long span rack in delhi
Nice post! I was looking for a simple solution for embedding libraries in OSGi bundles. bnd-maven-plugin seems perfect.
ReplyDeleteHeavy Duty Rack in Hyderabad
Heavy Duty Mezzanine Floor in Delhi
Good job! I liked the step-by-step instructions. I was able to get my project working within minutes.
ReplyDeletewarehouse storage racks in delhi
mezzanine floor noida
Suggestion: Could you cover a bit about potential issues when embedding dependencies with bnd-maven-plugin?
ReplyDeletemodular mezzanine floor manufacturer
heavy duty rack gurgaon
Very useful! I had no idea that I could automate this process. I’ll definitely be using this in my Maven builds.
ReplyDeletecable tray in delhi
slotted angle rack in India
Love it! This blog makes understanding Maven configurations a lot easier, especially for beginners. Thanks!
ReplyDeletelong span rack noida
pallet rack in gurgaon
Does this plugin work well with complex multi-module projects? I'd love to see some tips on that.
ReplyDeletemezzanine floor ghaziabad
office chair in gurgaon
Excellent article! Really concise and informative. Can we use bnd-maven-plugin with non-OSGi projects too?
ReplyDeleteFranchise Event
Distributorship Opportunities
New to Maven: How does embedding dependencies here differ from using the shade plugin?
ReplyDeletetwo tier racking system
Tea Distributorship
Just what I needed! Thank you for explaining the Embed-Dependency syntax in detail. Made my life easier!
ReplyDeletePure Lavender Oil Manufacturer in Korea
Sparsh Bagga
Interesting approach! I usually use the assembly plugin for packaging, but this seems more straightforward for dependencies.
ReplyDeletefabric storage rack manufacturer
SEO Company
Helpful read! Do you have any troubleshooting tips for when dependencies don’t embed correctly?
ReplyDeletestrech wrapping machine delhi
Retail Franchise
One question: Is there any performance impact at runtime when dependencies are embedded this way?
ReplyDeleteCentrifugal Blowers
Pallet rack manufacturer in India