Comments (5)
Export-Package has 2 functions. It selects a set of packages to include from the class path and to export, Private-Package also includes but does not export. This was the original design.
However, since the annotations, the modern way is to include the full project classes and then use annotations to indicate which are exported with @Export
and @Version
in the package-info file. Under the hood, this uses the following instructions:
-includepackage
β Include the given packages and process the annotations, default are all the classes in the project. However, notice that the packages may come anywhere from the class path. I.e. if bundle foo is on the class/build path, you can include its packages.-privatepackage
β Include the given packages but do not process the annotations, default empty-exportcontents
β Do not include anything but after-includeresource
, and other instructions filled the JAR, export the given packages. Default empty
You can only get the default model (= all project classes) when you do not set any of them. If you touch one or *-Package, etc. you have to set them all.
Now, imho defaults work best. Why on earth do you want to use the Bundle-ClassPath? This is almost always a bad idea. I might be missing something but in your setup, there is absolutely no reason to have any setup in bnd. Just take the defaults and add the package-info.java
with the export annotations to the APIs.
from bnd.
I think this is answered, please reopen if thre are more questions.
from bnd.
Hi @pkriens,
thanks for your response! This was very helpful, and in the end, I went with the -exportcontents
instruction as this is what I wanted to accomplish in the first place!
I've seen this before, but from the instructions documentation page, it only contains so little info that I wasn't sure if the mentioned class path would include the Bundle-ClassPath
as well.
Maybe the actual documentation of the instruction could be enhanced a bit? Thinking of the -includeresource
documentation that contains a lot of different use cases and combinations with macros. Should I open a new issue ticket for that and maybe propose a small draft - in this case, with my point of view mostly for a combination of Bndtools with Maven?
To answer your valid question why on earth do we use the Bundle-ClassPath
π
We have a shared library built with Maven that is in no way compliant with OSGi and its annotations that are used among different Java IDEs, in my case, consumed by Eclipse. Its developers have no clue about OSGi (or anything Eclipse / bundle magic related).
We use the Bundle-ClassPath
so that the bundle that is then used on the Eclipse side is only one (and not many, not one per module) that we can easily exchange and shade other stuff into (this is done via Maven). So using the Bundle-ClassPath
is firstly for simplification, secondly for convenience, and thirdly due to the developers having no clue of OSGi, and I'm the only one responsible for creating this Eclipse-specific OSGi bundle. So basically plugging in OSGi in a mostly non-OSGi environment to satisfy the needs of Eclipse ^^
from bnd.
Should I open a new issue ticket for that and maybe propose a small draft - in this case, with my point of view mostly for a combination of Bndtools with Maven?
@thahnen
Yes please, documentation improvements are very much appreciated :) A PR would be fine. You can describe the problem solved in the PR description.
from bnd.
Please submit a PR. However, realize that you might be surprised that the information is already there. A problem with OSGi is that some of its foundational concepts are quite new and that makes them hard to recognize. Once you have tried to explain it to others, it is clear to you why the existing documentation suddenly makes sense.
However, it is true that -includepackage
and -privatepackage
are relatively new, and also the default to include the project is new. I've described it in several places but it might be nice to have a single page that pulls all this together.
Please make a draft and i will try to contribute to this.
from bnd.
Related Issues (20)
- Allow the same PID for both pid and factoryPid attribute in @ObjectClassDefinition HOT 6
- Add something to support tools install with associated bndtools workspace templates HOT 20
- Ability to configure threshold for semantic versioning failures HOT 1
- Extend artifact with additional attributes HOT 5
- bndtools should assist with importing projects from known bnd workspaces HOT 14
- Cannot create new Bnd OSGi Project with current master HEAD HOT 5
- Contribute oomph setups for bndtools 7.1+ all-in-one install HOT 1
- Provide bndtools 7.1+ p2 release repositories so that oomph setups can refer to specific bndtools versions HOT 7
- Bnd can cause a .jar to contain the wrong modulesβ classes HOT 5
- NPE in Add to -buildpath Quickfix HOT 2
- bnd-maven-plugin: Explicit Service-Component instruction is merged with value generated from `DSAnnotations` plugin HOT 6
- Bndtools / Maven with sources JAR HOT 5
- Add Maven, Eclipse and IntelliJ folders to gitignore HOT 1
- EphemeralPortTest failing intermittently HOT 8
- ProjectResolverTest failing HOT 32
- Compile error on JDK 21: aQute/lib/collections/SortedList doesn't fully implement SortedSet/List interfaces HOT 2
- Running bnd shell command under windows
- Spring Boot 3.3.0 causing StackOverflowError HOT 3
- ANSI Console doesn't work with bndtools HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bnd.