Classifier jars: separate Java library from native libs#1388
Classifier jars: separate Java library from native libs#1388
Conversation
|
I have been pondering whether instead of per OS, we should publish classifier jars per OS/Arch combination instead. However i am not entirely sure of how the consumers of the library would be able to get all the native libs for a particular OS, without having to explicitly list all the archs… |
|
@gotson have you seen how javafx separates os-specific stuff in separate dependencies separated by classifiers? |
I was not aware, however i don't think we need OS detection on Maven side. The different libraries are more for packaging an app, is what i think, but again i may be wrong. It seems those other projects support less OS/arch couples than we do too. |
|
@pavel-yazev-km tagging you here as you seem to be one of the few people using Android. Given the android native libs need manual extraction anyway, how would you feel if the default package did not ship the Android native libs ? |
|
@gotson significantly less comfortable to upgrade, but not a deal breaker It would make us build it every time, which takes
Compared to 5 mins of extracting the necessary Since the build process requires some lengthy and resource heavy operations (even though it is neatly containerized), some folks would probably consider the alternatives. |
|
accidentally used my personal account ^ |
@pavel-yazev-km Android libs would still be available in the specific jar with classifier |
|
@gotson just to confirm my understanding Currently we take the Will it not be available anymore? |
That PR would result in multiple jars being published, both on Maven Central and in the Github Releases:
With classifiers, one could add multiple dependencies depending of what they want. For Android, you would need to download the jar with the For someone using Maven Central, for example if they are only interested in macOS libs, they could use the following: <dependencies>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.51.3.0</version>
<classifier>without-natives</classifier>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.51.3.0</version>
<classifier>natives-mac</classifier>
</dependency>
</dependencies>The first jar would have the classes, but no native libraries. This would allow for composition, depending on what you need, without having to pull and bundle libs you won't be using. |
|
@gotson thanks! The new approach doesn't seem to create additional effort for our use-case. |
Thanks for confirming. It could shave off ~4.5Mb on the jar by not shipping Android libs, which anyhow have to be manually extracted. I'll adjust the PR with those changes in mind. |
Alternative to #1387
Not sure which approach we should go for.
The following classifiers are added:
natives-android,natives-linux,natives-freebsd,natives-mac,natives-windows.Not sure if splitting Linux and Linux-Musl makes sense or not.natives-all.The name may not be the best, but at least it's better thanall.without-nativesThis way of doing has much less friction on the overall project than the multi-modules approach.