如何找到第三方库版本?
在我的项目中,我想查找第 3 方库的版本。我只有 jar 文件,其中一些包含带有版本号的清单文件,但其他文件则不包含。除了显化还有别的办法吗?
In my project I want to find what is the version of 3rd party libraries. I only have the jar file and some of them contains manifest file with version number in but others don't. Is there a way other than manifest?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一般技术是找到一个有多个版本的 jar 的地方,并使用文件大小和校验和将这些 jar 与您的版本进行比较。
因此,转到 Maven 搜索(一个很好的起点)并搜索您的库。然后查看您在那里找到的版本,并将文件大小与您拥有的版本进行比较。最后,将校验和与您的 jar 进行比较,或者仅使用二进制比较。如果maven上没有,那么在网络上搜索是最后的手段。
这做起来相当乏味,但大多数时候都是有效的。但是,并不总是能够找到给定 jar 的版本,因为它可能不再存在。
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.
So, go to Maven Search (a good place to start) and search for your library. 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. 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.
不可以。您必须查看 .class 文件的编译日期,并根据他们发布的相关内容手动将其与发布日期相关联。
No. You would have to look at the compilation dates of the .class files and relate that manually to release dates as per whatever they publish about that.
正如您所注意到的,唯一的半标准机制是在 MANIFEST.MF 中包含版本信息。当然,许多项目 JAR 的文件名中都有版本。否则没有其他通用方法来定义或确定库的“版本”。
The only semi-standard mechanism would be including version information in MANIFEST.MF, as you note. And, of course, many project JARs have a version in the file name. There is otherwise no other general way to define or determine the "version" of a library.