简体   繁体   English

仅下载与Java 1.6兼容的库的方法

[英]A way to download only java 1.6 compatible libraries

How I can make maven to download only java 1.6 compatible libraries? 我如何才能使Maven仅下载与Java 1.6兼容的库? I have tomcat 6 and java 1.6.0_38. 我有tomcat 6和Java 1.6.0_38。 Or how I can find incompatible libs? 或者如何找到不兼容的库?

http://pastebin.com/WnwZL2RX list of dependencies. http://pastebin.com/WnwZL2RX依赖性列表。

If it's a one-time task which you have to run over the list your have provided then I would propose a manual approach described here: 如果这是一项一次性任务,您必须在提供的列表上运行,那么我将在此处提出一种手动方法:

What version of javac built my jar? 什么版本的javac构建了我的jar?

As for automatic check then you would have to implement your own maven plugin which will use similar approach to the one described above or drill into JAR manifest in order to get the Java version. 至于自动检查,那么您将必须实现自己的maven插件,该插件将使用与上述方法类似的方法或深入JAR清单以获取Java版本。

A very interesting question i hope to be able to check back for a more satisfying answer. 我希望能够提出一个非常有趣的问题,以得到更令人满意的答案。

Maven is not able to perform such a task - and as faar as i know (i only checked back with a 5 minute websearch) there is no plugin available for this task. Maven无法执行此类任务-据我所知(我只在5分钟的网络搜索中就回来了),没有插件可用于此任务。

In the end Maven supports with the dependency management by resolving dependencies of dependencies and has default approaches when it comes to versions of the same dependency ( "the closest version wins" ) - regardless of this you will be in charge when it comes to compatibility between your own source and third party source. 最终,Maven通过解决依赖关系的依赖关系来支持依赖关系管理,并且在涉及相同依赖关系的版本时使用默认方法( “最接近的版本获胜” )-无论如何,您都将负责相互之间的兼容性。您自己的来源和第三方来源。

Especially when talking about runtime incompatibility this could be a quite hard task to find out about issues. 特别是在谈论运行时不兼容性时,要找出问题可能是一项艰巨的任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM