Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 15:15 Go to next message
Márcio Koch is currently offline Márcio KochFriend
Messages: 62
Registered: August 2013
Member
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 10:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
How do you build / Package / run your stufe

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: How to get the DSL version in run time [message #1873388 is a reply to message #1873385] Fri, 13 December 2024 10:33 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
Maybe you Can Replicate some ideas from XtextVersion class

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Previous Topic:Cannot resolve project dependencies: org.eclipse.equinox.p2.iu
Next Topic: Call To Action: Secure the future maintenance of Xtext
Goto Forum:
  


Current Time: Tue Jan 14 18:02:02 GMT 2025

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

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

Back to the top