Skip to main content



      Home
Home » Modeling » TMF (Xtext) » How to get the DSL version in run time(How to get the DSL version in run time)
How to get the DSL version in run time [message #1873355] Thu, 12 December 2024 10:15 Go to next message
Eclipse UserFriend
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
	}
Re: How to get the DSL version in run time [message #1873385 is a reply to message #1873355] Fri, 13 December 2024 05:25 Go to previous messageGo to next message
Eclipse UserFriend
How do you build / Package / run your stufe
Re: How to get the DSL version in run time [message #1873388 is a reply to message #1873385] Fri, 13 December 2024 05:33 Go to previous message
Eclipse UserFriend
Maybe you Can Replicate some ideas from XtextVersion class
Previous Topic:Cannot resolve project dependencies: org.eclipse.equinox.p2.iu
Next Topic:Please use GitHub Discussions
Goto Forum:
  


Current Time: Sun Aug 31 17:10:54 EDT 2025

Powered by FUDForum. Page generated in 0.03952 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top