Comments (2)
I am not really familiar with how sbt-osgi is used, but do all sbt-osgi treat bundle
to be same as packageBin
, or only some? If people do not make the distinction between the regular JAR and OSGi bundle JAR, then maybe the plugin should reimplement packageBin
instead of adding bundle
? That might reduce the overall confusion around how the plugin is expected to behave with regard to publishing or interaction with other plugins.
On the other hand, the whole point of OSGi iirc is to create a module system on top of the JAR ecosystem by allowing private import etc, so I don't understand how it's useful to treat raw JAR as your bundle. Maybe it's a special case only for open source libraries that are expected to be part of module participant, but not fully take advantage of it? Either case, if we want to support Compile / sbt.Keys.packageBin := bundle.value
, then bundle
can't transitively call packageBin
. fullClasspath
depends on exportedProducts
, which depends on packageBin
when exportJars
is true.
from sbt-osgi.
I am not really familiar with how sbt-osgi is used, but do all sbt-osgi treat bundle to be same as packageBin, or only some?
I am also familiarizing myself with the sbt-osgi as well, but from what I can tell users basically treat bundle in the same way as packageBin
which is why PR's like #32 exist.
If people do not make the distinction between the regular JAR and OSGi bundle JAR, then maybe the plugin should reimplement
packageBin
instead of addingbundle
? That might reduce the overall confusion around how the plugin is expected to behave with regard to publishing or interaction with other plugins.
From what I can tell this is definitely the ideal case, but there appears to be asynchronicity issues which is whats adding the complications here. Specifically sbt-osgi's bundle
needs to be run either before or after packageBin
if thats not the case then some data ends up missing which sbt-osgi needs to populate version information in the metadata, see response here #102 (comment), specifically
There seems to be no API in sbt, that ensures that the result of tasks, once they are done, stays stable. I have no idea (and also did not receive any helpful idea from others) how this can be fixed.
On the other hand, the whole point of OSGi iirc is to create a module system on top of the JAR ecosystem by allowing private import etc, so I don't understand how it's useful to treat raw JAR as your bundle. Maybe it's a special case only for open source libraries that are expected to be part of module participant, but not fully take advantage of it?
So in my specific case, the original problem I hit is that since sbt-osgi was changed to use (dependencyClasspathAsJars in Compile).value.map(_.data) ++ (products in Compile).value
to detect which jar's to automatically include in the bundle, it no longer worked with edge cases such as sbt-assembly. I ended up solving this issue by just setting the explodedJars
setting (i.e. https://github.com/apache/incubator-pekko/blob/main/project/OSGi.scala#L85-L90) which solved the problem, but I guess can be argued isn't entirely clean?
Either case, if we want to support
Compile / sbt.Keys.packageBin := bundle.value
, thenbundle
can't transitively callpackageBin
.fullClasspath
depends onexportedProducts
, which depends onpackageBin
whenexportJars
is true.
I am still somewhat unsure whether this is an actual problem or not, the reason behind wanting to use fullClasspath
was to fix an issue in Pekko where we had a bespoke case of creating fatjar using sbt-assembly that had zero dependencies and because that jar had zero dependencies it wasn't contained within dependencyClasspathAsJars
(but is still contained within fullClasspath
). So one can make an argument that this really is an exceptional case and hence the usage of explodedJars
is appropriate.
On the other hand, its not the best user experience because if you don't do this, you basically create broken jar's which you only figure out at runtime in another project that includes your jar's as a standard dependency.
In short from what I can understand, ideally we would just use fullClasspath
since that contains all the same jar's (generated by packageBin
) that you would ordinarily have, but this doesn't work because of a technical limitation in sbt (the necessary dependency information is missing at that point in time) so instead we are using (dependencyClasspathAsJars in Compile).value.map(_.data) ++ (products in Compile).value
.
from sbt-osgi.
Related Issues (20)
- Fix regression when using Jar's to force proper manifest files HOT 2
- Duplicated `META-INF/MANIFEST.MF` entries when using `packageWithJVMJar := true` on Windows HOT 10
- Write tests for caching functionality
- 0.93 for sbt 0.13 HOT 1
- Document how to publish OSGi bundles
- Missing imported versions for packages from project dependencies
- No sbt 0.13 artefact available 0.9.4 and forward HOT 2
- How to exclude libraries that are marked with Provided HOT 1
- Release 0.9.5 HOT 7
- version 0.9.5 release notes? HOT 1
- Travis CI is dropped HOT 1
- `ConcurrentModificationException` when bunding on JDK17 HOT 1
- Race condition in the dependencies of the osgiBundle task HOT 16
- sbt-osgi disapeared for the maven repo HOT 3
- Publish to Maven central using sbt-ci-release and groupId `com.github.sbt` HOT 5
- Should we recruit new maintainers? HOT 4
- Change from travis to github actions
- Make a custom release of sbt-osgi 0.9.4 + Invalid CEN extra data field patch HOT 8
- Release notes for 0.9.6 and 0.9.7? HOT 3
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 sbt-osgi.