Can I use java-8 compiled project/library in a java-11 spring boot 2 project?

Viewed 2276

Maybe a stupid question, I am in a process of upgrading bunch of our frameworks/libraries to java 11. I have this 1 project (Project Dep) that is a dependency of another project (Proj X). Both are java 8 and to be upgraded to Java 11.

However, both projects are big and might take days to be done, the Proj D is considerably larger (and used by a lot of devs) than Project X using it. I am thinking just upgrading the Proj X to java 11 and spring boot 2, and use the java 8 version of Proj D.

Will that work? I am asking just to have a clear path on what should I do in order and prioritize.

2 Answers

Yes, you could use the Project D(dependency Java 8) in Project X(Java 11) also Check for deprecation of packages in Java 11 and make sure you update the deprecated packages in Java 8 Project. Or If you want to upgrade both to Java 11 not a problem. Consider your time and Upgrading is always a better option.

It doesn't matter what version the project is in, it matters what version the JVM that will run it is. It must be at least the version of any of the dependencies.

Related