{"id":13806007,"url":"https://github.com/palantir/dropwizard-version-info","last_synced_at":"2025-05-13T21:32:02.742Z","repository":{"id":66049742,"uuid":"52120162","full_name":"palantir/dropwizard-version-info","owner":"palantir","description":"A simple Dropwizard bundle which exposes a version string as a Jersey resource under `/version`.","archived":true,"fork":false,"pushed_at":"2017-01-09T04:05:36.000Z","size":158,"stargazers_count":7,"open_issues_count":6,"forks_count":12,"subscribers_count":6,"default_branch":"develop","last_synced_at":"2024-04-14T02:47:49.890Z","etag":null,"topics":["octo-correct-managed"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/palantir.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-02-19T22:17:31.000Z","updated_at":"2023-01-28T11:02:28.000Z","dependencies_parsed_at":"2023-07-09T07:30:20.821Z","dependency_job_id":null,"html_url":"https://github.com/palantir/dropwizard-version-info","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palantir%2Fdropwizard-version-info","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palantir%2Fdropwizard-version-info/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palantir%2Fdropwizard-version-info/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palantir%2Fdropwizard-version-info/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/palantir","download_url":"https://codeload.github.com/palantir/dropwizard-version-info/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225260369,"owners_count":17446086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["octo-correct-managed"],"created_at":"2024-08-04T01:01:07.090Z","updated_at":"2024-11-18T22:31:05.809Z","avatar_url":"https://github.com/palantir.png","language":"Java","funding_links":[],"categories":["Open Source"],"sub_categories":["Eclipse"],"readme":"[![Circle CI](https://circleci.com/gh/palantir/dropwizard-version-info.svg?style=shield\u0026circle-token=0f0266bd0245635428b61e832c4f59c408e915e6)](https://circleci.com/gh/palantir/dropwizard-version-info)\n[ ![Download](https://api.bintray.com/packages/palantir/releases/dropwizard-version-info/images/download.svg) ](https://bintray.com/palantir/releases/dropwizard-version-info/_latestVersion)\n\nVersion Info Bundle\n===================\n\nIntroduction\n------------\n\n`VersionInfoBundle` is a simple Dropwizard bundle which exposes a\nversion string as a Jersey resource under `/version`.\n\nUsing the bundle\n----------------\n\n1.  Create a version.properties file that contains a `productVersion`\n    key in the \u003cproject_dir\u003e/src/main/resources/. It should look something like\n    this:\n\n    ```\n    productVersion: \u003cversion\u003e\n    ```\n\n    If the properties file cannot be read (for example, because of an\n    incorrect path or an IO error), the bundle will throw a\n    `RuntimeException` on construction. If the properties file can be\n    read, but the `productVersion` key cannot be found, then the version\n    will be \"unknown\".\n\n2.  Add the `com.palantir.versioninfo:dropwizard-version-info:\u003cVERSION\u003e`\n    dependency to your project's build.gradle file. The most recent\n    version number can be found in the [Relase Notes]\n    (https://github.com/palantir/dropwizard-version-info/releases).\n    The dependencies section should look something like this:\n\n    ```\n    dependencies {\n      // ... unrelated dependencies omitted ...\n\n      compile \"com.palantir.versioninfo:dropwizard-version-info:\u003cVERSION\u003e\"\n    }\n    ```\n\n3.  Add the bundle in your Dropwizard application's `initialize` method\n    (or create one if it doesn't already exist). It should look\n    something like this:\n\n    ```\n    @Override\n    public void initialize(Bootstrap\u003cMyConfiguration\u003e bootstrap) {\n        bootstrap.addBundle(new VersionInfoBundle());\n    }\n    ```\n\n4.  Run your server, then access `\u003cAPI_ROOT\u003e/version`. The `\u003cAPI_ROOT\u003e`\n    is defined by the `rootPath` and `applicationContextPath` in your\n    Dropwizard server configuration.\n\n5.  If your application uses [Feign](https://github.com/Netflix/feign)\n    to build clients, make sure your service interface extends\n    VersionInfoService interface. The dependencies section for your\n    `-api` project should look like this:\n\n    ```\n    dependencies {\n      // ... unrelated dependencies omitted ...\n\n      compile \"com.palantir.versioninfo:dropwizard-version-info-api:\u003cVERSION\u003e\"\n    }\n    ```\n    Your service interface should look like this:\n\n    ```\n    public interface ExampleService extends VersionInfoService {\n        @GET\n        @Path(\"hello\")\n        @Produces(MediaType.TEXT_PLAIN)\n        String hello();\n    }\n    ```\n\nCustom resource path\n--------------------\n\nTo load the version.properties file from somewhere else in the\nclasspath, pass the path to it as an argument to the bundle's\nconstructor:\n\n```\n@Override\npublic void initialize(Bootstrap\u003cMyConfiguration\u003e bootstrap) {\n    bootstrap.addBundle(new VersionInfoBundle(\"/properties/info.properties\"));\n}\n```\n\nGenerating product version from Git\n-----------------------------------\n\nTo generate the product version from Git, use the [Git-Version Gradle Plugin](https://github.com/palantir/gradle-git-version).\nYou can use the `write-version.gradle` script to write the version from git into the `version.properties` file:\n\n1. In your `build.gradle`, include the `write-version.gradle` dependency:\n\n    ```\n    apply from: \"${rootDir}/write-version.gradle\"\n    ```\n\n2. Set your compile task to depend on the generation of the version file:\n\n    ```\n    compileJava.dependsOn writeVersion\n    ```\n\n3. Set your `.gitignore` to ignore changes to the `version.properties` file:\n\n    ```\n    *version.properties\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalantir%2Fdropwizard-version-info","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpalantir%2Fdropwizard-version-info","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalantir%2Fdropwizard-version-info/lists"}