How to get the DSL version in run time [message #1873355] |
Thu, 12 December 2024 10:15  |
Eclipse User |
|
|
|
Hi, I would like to retrieve my DSL version to log it when my Java application, which was generated by my DSL, launches. When the code is generated in the Eclipse IDE, this method works and returns the version, but when it is generated using mvn clean generate-sources, it returns null. Any tips to solve this would be appreciated:
def getBundleVersion() {
if (bundleVersion === null) {
try {
val bundle = FrameworkUtil.getBundle(getClass())
if (bundle === null) {
println("Got bundle NULL for class: " + (getClass()?.name ?: 'null'))
}
bundleVersion = bundle?.getVersion() ?: null;
if (bundleVersion !== null && bundleVersion.toString.blank) {
bundleVersion = null
}
println("Got bundleVersion:[" + bundleVersion + "]")
} catch(Exception e) {
println("DSL Plug-in: Error at getBundleVersion: " + e.message)
bundleVersion = null
}
}
bundleVersion
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03952 seconds