An open API service indexing awesome lists of open source software.

https://github.com/dropwizard-bundles/dropwizard-version-bundle

A Dropwizard bundle that exposes the version of your application via the admin port.
https://github.com/dropwizard-bundles/dropwizard-version-bundle

dropwizard-bundle

Last synced: 5 months ago
JSON representation

A Dropwizard bundle that exposes the version of your application via the admin port.

Awesome Lists containing this project

README

          

# dropwizard-version-bundle

A [Dropwizard][dropwizard] bundle that exposes the version of your application as well as its
dependencies via the admin port.

[![Build Status](https://secure.travis-ci.org/dropwizard-bundles/dropwizard-version-bundle.png?branch=master)]
(http://travis-ci.org/dropwizard-bundles/dropwizard-version-bundle)

## Getting Started

Just add this maven dependency to get started:

```xml

io.dropwizard-bundles
dropwizard-version-bundle
1.0.5

```

Add the bundle to your environment using your choice of version supplier:

```java
public class MyApplication extends Application {
@Override
public void initialize(Bootstrap bootstrap) {
VersionSupplier supplier = new MavenVersionSupplier("", "");
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.

```bash
curl localhost:8081/version
```

## Customizing the version supplier

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.

[dropwizard]: http://dropwizard.io