Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the minimum JDK version of a specific version of maven dependency?

Now I use the JDK1.5 to develop the program, so I have to guarantee the maven dependencies I want to use are compatible with the JDK 1.5 . Sometimes, latest version needs jdk higher than 1.5 but older version may fit. But how to find the minimum JDK version of a specific version of maven dependency? I have tried mvnrepository.com but can not find the jdk requirement. Some project home page only show the jdk requirement of latest version. Anyone can help me? Thank you!

like image 990
Germinate Avatar asked Nov 08 '16 07:11

Germinate


People also ask

What is the minimum JDK version needed for latest Maven installation?

Additionally, starting from Spring Boot 2.0, Java 8 is the minimum version.

Which JDK is used by Maven?

The Maven tool uses JDK version 11.0. 10. The default JDK is set to 13.0.

How do I set Java version to Maven?

Method 1: Change the JAVA_HOME path Maven uses the JAVA_HOME environment variable to find which Java version it is supposed to run. If a different version of Java is needed, set the JAVA_HOME to the path of the specific version of JDK.

Does Maven support Java 17?

In case of Maven, we specify the compiler plugin to use Maven with Java 17. The next step is to basically upgrade the dependencies of our application.


1 Answers

You can check the major/minor version of the class files. If the JAR was built with Maven you can check the version of the JDK used to build it in the META-INF/MANIFEST.MF file which is most likely the minimum version.

A way to check without downloading the JAR is to check the POM on maven central e.g.

http://search.maven.org/#artifactdetails%7Cnet.openhft%7Cchronicle-queue%7C4.5.15%7Cbundle

needs 1.8

       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <compilerArgument>-Xlint:deprecation</compilerArgument>
                <compilerArgument>-XDignore.symbol.file</compilerArgument>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>

Something to consider, if Oracle with all it's resources doesn't support Java 7 for free, should you?

like image 117
Peter Lawrey Avatar answered Sep 23 '22 03:09

Peter Lawrey