如何找到特定版本的maven依赖项的最低JDK版本?

Ger*_*ate 9 java maven maven-dependency

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

Pet*_*rey 5

您可以检查类文件的主要/次要版本。如果 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>
Run Code Online (Sandbox Code Playgroud)

需要考虑的是,如果 Oracle 及其所有资源不免费支持 Java 7,您应该考虑吗?