Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6041589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:41:00+00:00 2026-05-23T06:41:00+00:00

Currently when I am writting a bundle in that depends on a package, I

  • 0

Currently when I am writting a bundle in that depends on a package, I have to “import” or “depend” on a whole other bundle in Maven that contains that package.

This seems like it is counter-productive to what OSGi gives me.

For example let’s say I have two bundles: BundleAPI and BundleImpl.

BundleAPI provides the API interfaces:

// BundleAPI's manifest
export-package: com.service.api

BundleImpl provides the implementation:

//BundleImpl's manifest
import-package com.service.api

However, when I am coding BundleImpl in Eclipse, I am forced to “depend” in maven POM on BundleAPI itself – so that eclipse does not complain.

//BundleImpl's POM
<dependency>
    <groupId>com.service</groupId>
    <artifactId>com.service.api</artifactId>
    [...]
</dependency>

So – on one hand, I am depending only on the package com.service.api, while on the other – I need to have the whole bundle – BundleAPI.

Is there a way to make maven or eclipse smart enough to just find the packages somewhere, instead of whole bundles?

I am very much confused as to how this works – any type of clarity here would be great. Maybe I am missing something fundamentally simple?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:41:01+00:00Added an answer on May 23, 2026 at 6:41 am

    The key is to distinguish between build-time dependencies and runtime dependencies.

    At build time you have to depend on a whole artifact, i.e. a JAR file or bundle. That’s pretty much unavoidable because of the way Java compilers work. However at runtime you depend only on the packages you use in your bundle, and this is how OSGi manages runtime substitution. This is the Import-Package statement in your final bundle.

    Of course as a developer you don’t want to list two parallel sets of dependencies, that would be crazy. Fortunately maven-bundle-plugin is based on a tool called bnd that calculates the Import-Package statement for you based on analysing your code and discovering the actual packages used. Other tools such as bndtools (an Eclipse-based IDE for OSGi development) also use bnd in this way. Incidentally bnd is much more reliable and accurate than any human at doing this job!

    So, you define only the module-level dependencies that you need at build time, and the tool generates the runtime package-level dependencies.

    I would recommend against using Tycho because it forces you to use Eclipse PDE, which in turn forces you to manually manage imported packages (for the sake of full disclosure, I am the author of bndtools which competes against PDE).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am currently writting a method that reads date from a firebird database. Here
I'm currently writing a Java app that interfaces with a MySQL database. My problem
I'm currently writing an app in Android that works with the GPS. At the
I'm currently writing a small python app that embeds cherrypy and django using py2app.
i'm currently writing on some piece of code in android 2.1 that is supposed
I'm tearing my hair out over this gotcha and have been for a couple
I am currently writing an app that within a certain activity, we want the
I have been trying to figure out how installers work and how they bundle
Currently I'm writting VB functions and save them as an Excel addin .xlam file.
Currently I'm working on a small program that reads large files and sorts them.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.