简体   繁体   English

如何找出第三方库版本?

[英]How to find out 3rd party libraries version?

In my project I want to find what is the version of 3rd party libraries. 在我的项目中,我想查找第3方库的版本。 I only have the jar file and some of them contains manifest file with version number in but others don't. 我只有jar文件,其中一些包含清单文件(带有版本号),而其他则没有。 Is there a way other than manifest? 除了清单以外,还有其他方法吗?

The general technique is to find a place which has multiple versions of the jars, and compare the jars with your version, using file size and checksums. 通用技术是找到一个具有多个jar版本的地方,并使用文件大小和校验和将jar与您的版本进行比较。

So, go to Maven Search (a good place to start) and search for your library. 因此,转到Maven Search (一个不错的起点)并搜索您的库。 Then look through the versions that you find there and compare the file sizes with the one you have. 然后浏览找到的版本,并将文件大小与拥有的文件大小进行比较。 Finally, compare the checksums with your jar, or just using a binary compare. 最后,将校验和与jar进行比较,或者仅使用二进制比较。 If it's not on maven, then searching on the web is a last resort. 如果不是在行家中,那么在网上搜索是最后的选择。

This is quite tedious to do, but most of the time it works. 这样做很繁琐,但大多数情况下都是可行的。 But, it isn't always possible to find out the version for a given jar, because it may not exist any more. 但是,并非总能找到给定jar的版本,因为它可能不再存在。

不能。您必须查看.class文件的编译日期,并手动将其关联以根据他们发布的日期发布日期。

The only semi-standard mechanism would be including version information in MANIFEST.MF, as you note. 如您所述,唯一的半标准机制是在MANIFEST.MF中包含版本信息。 And, of course, many project JARs have a version in the file name. 而且,当然,许多项目JAR在文件名中都有一个版本。 There is otherwise no other general way to define or determine the "version" of a library. 否则,没有其他通用方法可以定义或确定库的“版本”。

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

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