commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Carman <ja...@carmanconsulting.com>
Subject Re: Version classes
Date Wed, 15 Sep 2010 10:55:23 GMT
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


Mime
View raw message