gpt4 book ai didi

eclipse-rcp - Eclipse RCP : How do I programmatically get the version number from the product file?

转载 作者:行者123 更新时间:2023-12-02 17:54:07 25 4
gpt4 key购买 nike

我目前在属性文件中对版本号进行了硬编码,我希望能够以编程方式直接从 RCP 产品文件中获取版本号。这样,我就不需要在两个地方指定版本号。我无法找到有关这样做的文章。我正在使用 Eclipse RCP 3.x。

这可行吗?

谢谢。

最佳答案

不确定我完全理解你的问题(什么属性文件?),但你可以通过编程方式获取 osgi 包的版本(即“插件版本”),如下所示:

import org.osgi.framework.FrameworkUtil; 
import org.osgi.framework.Version;

Version v = FrameworkUtil.getBundle(SomeClass.class).getVersion();
String version = String.format("Version %d.%d.%d", v.getMajor(), v.getMinor(), v.getMicro());

其中 SomeClass 是插件中的类之一。

关于eclipse-rcp - Eclipse RCP : How do I programmatically get the version number from the product file?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4261103/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com