获取JVM中的Spring和其他框架版本号

发布于 2025-01-01 23:15:09 字数 391 浏览 6 评论 0原文

我正在尝试为基本的 java 应用程序创建一个“骨架”框架。

我想要添加的一件事是版本页面/显示,其中列出了当前附加的框架/库。

例如:

骨架版本:1.0.0 春季:2.5.6 Hibernate:Malbolge

Skeleton 项目的目的是让新开发人员能够轻松快速地启动一个强大的应用程序。
我认为最坏的情况是我可以搜索每个框架 jar 清单并使用它...但这并不有趣...

有人有不同的建议吗?如果项目要使用 Maven,这将是理所当然的...我可以解析 pom.xml 或某种程度的东西...

我想一个更明确的问题是:

给定一个 libs 文件夹;有没有一种方法可以在不接触清单的情况下动态收集 jars/frameworks 版本#?

I'm trying to create a 'skeleton' framework of sorts for a basic java app.

One thing I'm looking to add is a version page/display that list the current framework/libs attached.

For example:

Skeleton version: 1.0.0
Spring: 2.5.6
Hibernate: Malbolge

The purpose of the Skeleton project was to make it very easy for a new developer to quickly start a robust app.
I figured the worst case scenario is that I could search through every framework jars manifest and use that... but that's no fun...

Anyone have a different suggestion? This would be a no brainer if the project was going to use Maven... I could just parse the pom.xml or something to that extent...

I guess a more defined question is:

Given a folder of libs; is there a way to dynamically gather the jars/frameworks version # without touching the manifest?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

长发绾君心 2025-01-08 23:15:09

您可以使用 获取 Spring 版本SpringVersion类

我在上一个问题中有一个代码片段:

需要 Spring 版本# - 仅有 spring.jar 文件

You can get the Spring version using the SpringVersion class.

I had a code snippet in a previous question:

Need Spring version# - only have spring.jar file

空城仅有旧梦在 2025-01-08 23:15:09

Using System.getProperties() gives you a listing of JVM properties including the different version ids of the JRE, JVM and specification. Not sure if this will give Spring etc versions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文