Skip to content

Classifier jars: separate Java library from native libs#1388

Draft
gotson wants to merge 1 commit intomasterfrom
multi-jars
Draft

Classifier jars: separate Java library from native libs#1388
gotson wants to merge 1 commit intomasterfrom
multi-jars

Conversation

@gotson
Copy link
Collaborator

@gotson gotson commented Mar 6, 2026

Alternative to #1387

Not sure which approach we should go for.

The following classifiers are added:

  • natives only per OS: natives-android, natives-linux, natives-linux_musl, natives-freebsd, natives-mac, natives-windows. Not sure if splitting Linux and Linux-Musl makes sense or not.
  • natives for desktop (all OSes except Android): natives-desktop. The name may not be the best, but at least it's better than all.
  • the same default Jar but without any of the native libs: without-natives

This way of doing has much less friction on the overall project than the multi-modules approach.

@gotson gotson changed the title build classifier jars Classifier jars: separate native libs from Java library Mar 6, 2026
@gotson gotson changed the title Classifier jars: separate native libs from Java library Classifier jars: separate Java library from native libs Mar 6, 2026
@gotson gotson marked this pull request as draft March 6, 2026 03:54
@gotson
Copy link
Collaborator Author

gotson commented Mar 6, 2026

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 gotson added the review wanted This needs more eyes label Mar 6, 2026
@kkriske
Copy link
Contributor

kkriske commented Mar 6, 2026

@gotson have you seen how javafx separates os-specific stuff in separate dependencies separated by classifiers?
It's pretty neat. A specific package like javafx-base has a single dependency on itself but with <classifier>${javafx.platform}</classifier>: https://central.sonatype.com/artifact/org.openjfx/javafx-base
That property is resolved by the parent, by letting maven do profile-based os-detection: https://central.sonatype.com/artifact/org.openjfx/javafx

@gotson
Copy link
Collaborator Author

gotson commented Mar 9, 2026

@gotson have you seen how javafx separates os-specific stuff in separate dependencies separated by classifiers? It's pretty neat. A specific package like javafx-base has a single dependency on itself but with <classifier>${javafx.platform}</classifier>: central.sonatype.com/artifact/org.openjfx/javafx-base That property is resolved by the parent, by letting maven do profile-based os-detection: central.sonatype.com/artifact/org.openjfx/javafx

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review wanted This needs more eyes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants