commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <GGreg...@seagullsoftware.com>
Subject RE: Version classes
Date Wed, 15 Sep 2010 15:57:29 GMT
>versionOf(org.hibernate.Session.class);

That looks like a nice utility to add to [lang].

My preference would be for the sig "getVersion(Class)"

Gary

-----Original Message-----
From: jcarman@carmanconsulting.com [mailto:jcarman@carmanconsulting.com] On Behalf Of James
Carman
Sent: Wednesday, September 15, 2010 03:55
To: Commons Developers List
Subject: Re: Version classes

On Wed, Sep 15, 2010 at 6:45 AM, sebb <sebbaz@gmail.com> wrote:
>
> I like the idea.
>
> Apache JMeter does the same.
>
> It also includes the last SVN revision of whatever workspace was used
> to build it.
>
> Since the version is available to Maven (or Ant) it could update (or
> perhaps create?) the version file as part of the build.
>
> If we decide to include the SVN revision as well, we could also add
> the SVN revision as a new manifest entry.
>
> Which makes me wonder - maybe another way to do this would be to have
> the getVersion() method read the Manifest entry?

We use a method like this:

public static String versionOf(Class c) {
  final String version = c.getPackage().getImplementationVersion();
  return StringUtils.isEmpty(version) ? "n/a" : version;
}

So, if you want to know what version of Hibernate you're using, you'd do:

versionOf(org.hibernate.Session.class);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message