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

Now I am using JDK1.5 to develop the program, so I have to ensure that the maven dependencies that I want to use are compatible with JDK 1.5. Sometimes the latest version requires jdk above 1.5, but an older version can fit. But how to find the minimum JDK version of a specific version of the maven dependency? I tried mvnrepository.com but cannot find jdk requirement. On any project home page, only the latest version jdk specification is displayed. Can anybody help me? Thanks!

+6
source share
2 answers

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

The way to check without loading the JAR is to check the POM on the central maven server, for example.

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

1.8 required

  <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 the resources does not support Java 7 for free, right?

+1
source

In most cases you can do this

  <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>{java.sourceversion}</source> <target>{java.targetversion}</target> </configuration> </plugin> </plugins> </build> 

that should be enough.

0
source

Source: https://habr.com/ru/post/1012133/


All Articles