How to retrieve the version of my custom extension in velocity

Hello,

I have developed and installed an extension which I can successfully use.
In velocity I call
$services.myextension.mymethod
and it works fine.

Since I have several versions of my extension, I was wondering whether there is a generic method which I can use to display the current version of my extension.

Thanks in advance for your help,

alex

The following will give your the version the extension “my.groupid:my.artifactid” available in the current wiki:

$services.extension.getInstalledExtension('my.groupid:my.artifactid', "wiki:${xcontext.database}").id.version

If possible a more generic and generally probably safer alternative is to check if what you want to use in your extension exist (like checking if some method exist, etc.).

Thanks Thomas,

It works a treat!

alex, happy

PS: and yes, testing whether method X which was implemented in a given version is present is something that we were also thinking about.