Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can I build a java class in jdk14 but use java 11 for my own library?

My library (using maven/java 11) has a dependency to a class in another library which used java 14 to compile the class.

So to build the dependency, I need to use java 14, but I don’t want consumers of my library to have to be forced to upgrade to java 14. The class I’m dependent on is a simple domain class that doesn’t use any java 14 features.

Is this possible? Or would I need to bump to java 14 in my own library?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If you’re going to depend on a third part lib that uses java14, your project must use at least java14.

If you can rebuild and distribute a custom version of the third party lib @ java11, you can keep your project at java11.

I highly recommend only sticking on LTS versions of Java: 7,8,11,17 as this makes it much easier for the ecosystem to use your code and build it. Java14 is already sunset.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading