简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM