Attend a User Group

Home » Atlassian Forums » Software » Confluence Development



Permlink Replies: 3 - Pages: 1 - Last Post: Jul 31, 2008 1:23 PM Last Post By: Brendan Patterson
Brendan Patterson

Posts: 336
Registered: 06/08/05
how to determine Confluence version programatically?
Posted: Jul 30, 2008 4:45 PM
Click to report abuse...   Click to reply to this thread Reply
Hi,

I've had some trouble figuring out how to determine the current version of the Confluence server in a Java plugin. i.e. v2.8.0 or whatever.

I've actually been able to find it using velocity, but I need it inside my java code. Silly I know.

Or the build number of Confluence would be fine too. Basically I want to make plugins that work across different versions when possible. For just the occasional difference between Confluence APIs it seems easier than maintaining seperate code bases.

Any hints?

thanks!
Brendan
Brendan Patterson

Posts: 336
Registered: 06/08/05
Re: how to determine Confluence version programatically?
Posted: Jul 30, 2008 5:35 PM    global.in_response_to.tooltip in response to: Brendan Patterson
Click to report abuse...   Click to reply to this thread Reply
I found the answer to my own question.

There are several helpful static methods in the class com.atlassian.confluence.util.GeneralUtil.

These include methods:
public static String getVersionNumber()
public static String getBuildNumber()
Gary S. Weaver

Posts: 63
Registered: 05/15/07
Re: how to determine Confluence version programatically?
Posted: Jul 31, 2008 1:08 PM    global.in_response_to.tooltip in response to: Brendan Patterson
Click to report abuse...   Click to reply to this thread Reply
I think that I would step back and consider this as a general issue- how should we handle in-general one Java app/library/plugin being able to use different incompatible versions of the same Java API. In past experience, certain parts of the Confluence API have changed significantly without deprecation between different minor versions of Confluence, so it should definitely be a topic near and dear to some of your hearts.

I just blogged about this, if you guys wouldn't mind taking a look and providing comments there. It's also my first blog post on weblogs.java.net. (I've finally succumbed to blogging about development. I am now just another dreg of society ;) .)
Brendan Patterson

Posts: 336
Registered: 06/08/05
Re: how to determine Confluence version programatically?
Posted: Jul 31, 2008 1:23 PM    global.in_response_to.tooltip in response to: Gary S. Weaver
Click to report abuse...   Click to reply to this thread Reply
Thanks for the blog about this issue. Keep the blogs coming :)

I like option #3 of your post quite a bit, though it might take the longest to set up (at least for me initially).

In my case for the small plugin I'm working on I'm just trying to do the quickest thing that works. But as a broader general class of problem particularly relevant to Atlassian's popular products, large active plugin community and frequent product updates I think this is an important issue to the hundreds (thousands?) of developers in this community.
Legend
Genius: 1000 - 10000 pts
Expert: 500 - 999 pts
Guide: 250 - 499 pts
Enthusiast: 50 - 249 pts
Newbie: 5 - 49 pts
Atlassian Employee
Atlassian Partner
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums