{"id":19299948,"url":"https://github.com/cloudogu/versionname","last_synced_at":"2026-01-11T17:35:39.851Z","repository":{"id":48583792,"uuid":"68388625","full_name":"cloudogu/versionName","owner":"cloudogu","description":"A tiny Java library that allows for conveniently reading the version name of an application","archived":false,"fork":false,"pushed_at":"2024-08-14T10:57:47.000Z","size":164,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"develop","last_synced_at":"2024-08-14T23:49:33.612Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudogu.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-16T14:50:58.000Z","updated_at":"2024-08-14T10:57:38.000Z","dependencies_parsed_at":"2024-08-13T23:09:56.531Z","dependency_job_id":null,"html_url":"https://github.com/cloudogu/versionName","commit_stats":null,"previous_names":["triologygmbh/versionname"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudogu%2FversionName","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudogu%2FversionName/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudogu%2FversionName/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudogu%2FversionName/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudogu","download_url":"https://codeload.github.com/cloudogu/versionName/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223893055,"owners_count":17220834,"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":[],"created_at":"2024-11-09T23:13:14.943Z","updated_at":"2026-01-11T17:35:39.802Z","avatar_url":"https://github.com/cloudogu.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"versionName\n===========\n\nversionName is a tiny Java library that allows for conveniently reading the version name of an application from\n\n - Manifest,\n - property file or\n - from a constant generated by an annotation processor.\n\n# Reading from manifest or property file\n\nversionName consists of one class (as said before it's tiny) [VersionNames](versionName/src/main/java/com/cloudogu/versionname/VersionNames.java) that provides methods for reading the version name.\nThe public methods return a String that is never `null`. In case of error, messages are written to a [SLF4J](http://slf4j.org/)-logger.\n\n- [VersionNames.getVersionNameFromProperties()](versionName/src/main/java/com/cloudogu/versionname/VersionNames.java),\n- [VersionNames.getVersionNameFromManifest()](versionName/src/main/java/com/cloudogu/versionname/VersionNames.java)\n\nTo use versionName, either copy [VersionNames](versionName/src/main/java/com/cloudogu/versionName/VersionNames.java) to your classpath or add the [latest stable version](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%20%22com.cloudogu.versionName%22%20AND%20a%3A%22versionName%22) to the dependency management tool of your choice.\n\nRead more about it in those two blog posts (Note that this refers to version 1.x and the maven coords and package names have changed since!)\n- [Version names with Maven: Creating the version name](https://www.triology.de/en/blog-entries/versionsnamen-mit-maven-erzeugen-des-versionsnamens) (which refers to the [examples](examples)) and\n- [Version names with Maven: Reading the version name](https://www.triology.de/en/blog-entries/version-names-with-maven-reading-the-version-name) (which refers to the library itself).\n\nWith maven for example\n```XML\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.cloudogu.versionName\u003c/groupId\u003e\n    \u003cartifactId\u003eversionName\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.cloudogu.versionName/versionName.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%20%22com.cloudogu.versionName%22%20AND%20a%3A%22versionName%22)\n\nYou can also get snapshot versions from our [snapshot repository](https://oss.sonatype.org/content/repositories/snapshots/com/cloudogu/versionName/versionName/) (for the most recent commit on develop branch).\nTo do so, add the following repo to your `pom.xml` or `settings.xml`:\n```xml\n\u003crepository\u003e\n    \u003cid\u003esnapshots-repo\u003c/id\u003e\n    \u003curl\u003ehttps://oss.sonatype.org/content/repositories/snapshots\u003c/url\u003e\n    \u003creleases\u003e\u003cenabled\u003efalse\u003c/enabled\u003e\u003c/releases\u003e\n    \u003csnapshots\u003e\u003cenabled\u003etrue\u003c/enabled\u003e\u003c/snapshots\u003e\n\u003c/repository\u003e\n```\n\n# Alternative: Using the annotation processor\n\nFrom a runtime perspective, its actually a bit odd reading a build-time constant from a file where it could just be\n\"baked into\" the application source code.\n\nThis misery can be ended using the [VersionNameProcessor](processor/src/main/java/com/cloudogu/versionname/VersionNameProcessor.java).\nIt generates a constant `Version.NAME` (package, class and field name can be customized). With this mechanism there is\nnot even the need for the `com.cloudogu.versionName:versionName` dependency.\n\nIn order to trigger the process, an annotation `@VersioName` must be set on a class or package. The `Version` class is\nthen generated into the same package when the following dependency is added to the build (e.g. with maven):\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.cloudogu.versionName\u003c/groupId\u003e\n    \u003cartifactId\u003eprocessor\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.0\u003c/version\u003e\n    \u003c!-- This dependency is only needed during compile time and should not be packaged into final JAR --\u003e\n    \u003cscope\u003eprovided\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.cloudogu.versionName/processor.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%20%22com.cloudogu.versionName%22%20AND%20a%3A%22processor%22)\nUsing the provided scope will add zero dependencies to your project, only the generated class.\n\nIn addition, the version name to be written must be passed as an argument `versionName` to the compiler, e.g. like so\nusing maven:\n\n```xml\n\u003cplugin\u003e\n    \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n    \u003cartifactId\u003emaven-compiler-plugin\u003c/artifactId\u003e\n    \u003cversion\u003e3.8.0\u003c/version\u003e\n    \u003cconfiguration\u003e\n        \u003ccompilerArgs\u003e\n            \u003carg\u003e-AversionName=${versionName}\u003c/arg\u003e\n        \u003c/compilerArgs\u003e\n    \u003c/configuration\u003e\n\u003c/plugin\u003e\n```\n\nSee also\n* the [full example using the annotation processor](examples/jar-without-deps) and\n* the [unit tests of the annotation processor](processor/src/test/java/com/cloudogu/versionname/VersionNameProcessorTest.java).\n\n# Examples\n\nThe examples show how to write a version name to your application using maven and how it can be read using the library from within applications (JAR or WAR).\nSee [examples/README.md](examples/README.md)\n\n# Jenkins\nRunning [Jenkinsfile](Jenkinsfile) with the [pipeline plugin](https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin) (tested with version 2.4) requires\n- Docker\n- Optional: You can add a build parameter `RECIPIENTS` that contains a comma-separated list of all email recipients\n\n# Releasing\n\n* rebase `main` onto `develop`\n* `mvn versions:set -DnewVersion=2.2.0 -DgenerateBackupPoms=false`\n* `git commit -m 'Prepare release'`, `tag -s`, `push`\n* rebase `develop` onto `main`\n* `mvn versions:set -DnewVersion=2.2.1-SNAPSHOT -DgenerateBackupPoms=false`\n* `git commit -m 'Prepare next development iteration'`, `push`\n\nWe might get rid of develop branch and the rebasing in the future.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudogu%2Fversionname","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudogu%2Fversionname","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudogu%2Fversionname/lists"}