现在,我使用JDK1.5来开发程序,因此我必须保证要使用的Maven依赖项与JDK 1.5兼容。有时,最新版本需要的jdk高于1.5,但较旧的版本可能适合。
但是如何找到特定Maven依赖版本的最低JDK版本呢?
我尝试了mvnrepository.com,但找不到jdk要求。一些项目主页仅显示最新版本的jdk要求。
有人可以帮助我吗?谢谢!

最佳答案

您可以检查类文件的主要/次要版本。如果JAR是使用Maven构建的,则可以在META-INF/MANIFEST.MF文件中检查用于构建它的JDK的版本,这很可能是最低版本。

无需下载JAR的一种检查方法是在Maven Central上检查POM,例如

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

需要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>

考虑一下,如果Oracle拥有全部资源,则不免费支持Java 7,对吗?

09-10 08:19
查看更多