A Dropwizard bundle that exposes the version of your application as well as its dependencies via the admin port.
[] (http://travis-ci.org/dropwizard-bundles/dropwizard-version-bundle)
Just add this maven dependency to get started:
<dependency>
<groupId>io.dropwizard-bundles</groupId>
<artifactId>dropwizard-version-bundle</artifactId>
<version>1.0.5</version>
</dependency>
Add the bundle to your environment using your choice of version supplier:
public class MyApplication extends Application<Configuration> {
@Override
public void initialize(Bootstrap<Configuration> bootstrap) {
VersionSupplier supplier = new MavenVersionSupplier("<YOUR GROUP>", "<YOUR ARTIFACT ID>");
bootstrap.addBundle(new VersionBundle(supplier));
}
@Override
public void run(Configuration cfg, Environment env) throws Exception {
// ...
}
}
Now you can access the the /version
URL on the admin port of your application to see the version
of your application as well as its dependencies.
For example if your application were running on localhost
with the admin server on port 8081 then
something like the following would show you your application's version.
curl localhost:8081/version
By default the bundle only comes with a single version supplier MavenVersionSupplier
that will
discover the version information for a particular maven artifact by reading the pom.properties
file in a maven produced jar.
The VersionSupplier
that plugs into the bundle is customizable however so you can define your own
implementation if your needs are different. If you implement a new VersionSupplier
that is
generally useful for others then please feel free to submit a pull request.