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

Time:11-15

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?

CodePudding user response:

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.

  • Related