{"id":13609320,"url":"https://github.com/dipien/semantic-version-gradle-plugin","last_synced_at":"2025-08-16T21:32:22.408Z","repository":{"id":41986026,"uuid":"264780733","full_name":"dipien/semantic-version-gradle-plugin","owner":"dipien","description":"Gradle Plugin to automatically use Semantic Versioning on your Gradle project","archived":false,"fork":false,"pushed_at":"2023-11-25T01:11:59.000Z","size":578,"stargazers_count":35,"open_issues_count":7,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-15T09:46:52.500Z","etag":null,"topics":["android","gradle","gradle-plugin","semantic-versioning","semver"],"latest_commit_sha":null,"homepage":"http://semanticversion.dipien.com","language":"Kotlin","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/dipien.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"patreon":"dipien","ko_fi":"maxirosson","custom":["http://alby.dipien.com"]}},"created_at":"2020-05-18T00:06:07.000Z","updated_at":"2024-08-18T14:12:49.000Z","dependencies_parsed_at":"2024-01-16T23:31:07.444Z","dependency_job_id":"74480b85-7fc3-4c93-93f8-cc8a169ca54c","html_url":"https://github.com/dipien/semantic-version-gradle-plugin","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipien%2Fsemantic-version-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipien%2Fsemantic-version-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipien%2Fsemantic-version-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipien%2Fsemantic-version-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dipien","download_url":"https://codeload.github.com/dipien/semantic-version-gradle-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230061413,"owners_count":18166703,"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":["android","gradle","gradle-plugin","semantic-versioning","semver"],"created_at":"2024-08-01T19:01:34.087Z","updated_at":"2025-08-16T21:32:22.394Z","avatar_url":"https://github.com/dipien.png","language":"Kotlin","funding_links":["https://patreon.com/dipien","https://ko-fi.com/maxirosson","http://alby.dipien.com"],"categories":["Kotlin"],"sub_categories":[],"readme":"[![Dipien](https://raw.githubusercontent.com/dipien/dipien-component-builder/master/.github/dipien_logo.png)](https://medium.com/dipien)\n\n# Semantic Version Gradle Plugin\n\nWith the Semantic Version Gradle Plugin you can automatically apply the [Semantic Versioning](https://semver.org/) specification to your Gradle project.\n\n**You can read more details about this plugin on this [article](https://medium.com/dipien/automatic-semantic-versioning-on-your-gradle-project-6343b626b27b)**\n\n## Usage\n\nApply the plugin on the root `build.gradle[.kts]`, replacing `X.Y.Z` with the [latest](https://github.com/dipien/semantic-version-gradle-plugin/releases/latest) version:\n\n```groovy\nbuildscript {\n    repositories {\n        mavenCentral() // or gradlePluginPortal()\n    }\n    dependencies {\n        classpath(\"com.dipien:semantic-version-gradle-plugin:X.Y.Z\")\n    }\n}\nversion = \"1.0.0\" // Assign your project version here\napply plugin: \"com.dipien.semantic-version\"\n```\n\nDefine your project version on your root `build.gradle[.kts]` using the Semantic Versioning specification but without any classifier. It's important you define the version before applying the plugin. The plugin will assign the root project version to all its subprojects.\n\n## Printing the project version\nThe `printVersion` task prints the project version on the console.\n\n```\n./gradlew printVersion\nOUTPUT: Version: 1.0.0-SNAPSHOT\n```\n\nBy default, the `SNAPSHOT` classifier is enabled. You can use the `-Psnapshot=false` parameter any time you want to use a stable version. For example when publishing an artifact, generating the release android app bundle, etc.\n\n```\n./gradlew printVersion -Psnapshot=false\nOUTPUT: Version: 1.0.0\n```\n\nYou can use alpha, beta or rc classifiers:\n\n```\n./gradlew printVersion -Palpha=true\nOUTPUT: Version: 1.0.0-ALPHA\n\n./gradlew printVersion -Pbeta=true\nOUTPUT: 1.0.0-BETA\n\n./gradlew printVersion -Prc=true\nOUTPUT: 1.0.0-RC\n```\n\nYou can also assign custom classifiers using the `versionClassifier` parameter:\n\n```\n./gradlew printVersion -PversionClassifier=canary\nOUTPUT: 1.0.0-canary\n```\n\n## Incrementing the project version\n\nThe `incrementVersion` task increments the project version on your root `build.gradle[.kts]` file. The `versionIncrementType` option defines the type of increment: `MAJOR`, `MINOR` or `PATCH`\n\n```\n// Increments the major from 1.0.0 to 2.0.0\n./gradlew incrementVersion --versionIncrementType=MAJOR\n\n// Increments the minor from 1.0.0 to 1.1.0\n./gradlew incrementVersion --versionIncrementType=MINOR\n\n// Increments the patch from 1.0.0 to 1.0.1\n./gradlew incrementVersion --versionIncrementType=PATCH\n```\n\nIf you want to also commit and push the version change, just add the `versionIncrementBranch` option with the HEAD branch.\n\n```\n./gradlew incrementVersion --versionIncrementType=MAJOR --versionIncrementBranch=master -PgitUserName=userName -PgitUserEmail=email@mail.com\n```\n\nYou can configure the commit message adding a prefix with the `commitMessagePrefix` option. For example\n\n```\n./gradlew incrementVersion --commitMessagePrefix=\"[my prefix] \" --versionIncrementType=MAJOR --versionIncrementBranch=master\n```\n\n## Advanced Configuration\nAll the configuration properties can be added using any of the following ways:\n\n* As a command-line parameter:\n\n```\n./gradlew ... -PgitUserEmail=\"email@mail.com\"\n```\n\n* As a property on a `gradle.properties` file:\n\n```\ngitUserEmail = \"email@mail.com\"\n```\n\n* As an extra property on the root `build.gradle[.kts]`, before applying the plugin:\n\n```\next.gitUserEmail = \"email@mail.com\"\n```\n\n* As a System Environment property\n\n### Maximum Major Version\nThe `maximumMajorVersion` parameter represents the maximum value allowed for the `MAJOR`. The default value is `99`, so by default `99.99.99` is the maximum supported version.\n\n### Maximum Minor Version\nThe `maximumMinorVersion` parameter represents the maximum value allowed for the `MINOR`. The default value is `99`, so by default `99.99.99` is the maximum supported version.\n\n### Maximum Patch Version\nThe `maximumPatchVersion` parameter represents the maximum value allowed for the `PATCH`. The default value is `99`, so by default `99.99.99` is the maximum supported version.\n\n### Snapshot\nThe `snapshot` parameter represents whether the version should have the `-SNAPSHOT` classifier or not. By default, all the versions are considered as snapshots, so all the local builds don't interfere with the release builds.\n\n### Alpha\nThe `alpha` parameter represents whether the version should have the `-ALPHA` classifier or not.\n\n### Beta\nThe `beta` parameter represents whether the version should have the `-BETA` classifier or not.\n\n### RC\nThe `rc` parameter represents whether the version should have the `-RC` classifier or not.\n\n### Version Classifier\nThe `versionClassifier` parameter represents the classifier appended to the version. You can use this property to define a custom version classifier.\n\n## Android Support\nThe plugin has some special features for Android projects. You just need to apply the `com.dipien.android.semantic-version` plugin instead of `com.dipien.semantic-version`.\nJust add this configuration to your root `build.gradle[.kts]` file, replacing `X.Y.Z` with the [latest](https://github.com/dipien/semantic-version-gradle-plugin/releases/latest) version\n\n```groovy\nbuildscript {\n    repositories {\n        mavenCentral() // or gradlePluginPortal()\n    }\n    dependencies {\n        classpath(\"com.dipien:semantic-version-android-gradle-plugin:X.Y.Z\")\n    }\n}\n\napply plugin: \"com.dipien.android.semantic-version\"\n```\n\n### Version code \u0026 version name\nOn android you have to define two version fields for an app:\n* Version code (`android:versionCode` on your `AndroidManifest.xml`). The version code is an incremental integer value that represents the version of the application code. The greatest value Google Play allows for a version code is `2100000000`.\n* Version name (`android:versionName` on your `AndroidManifest.xml`). The version name is a string value that represents the \"friendly\" version name displayed to the users.\n\nYou can get more details [here](http://developer.android.com/tools/publishing/versioning.html#appversioning).\n\nIt's a good practice to have a direct relationship between both versions to avoid confusion during the development and release process. At least, you should be able to infer the version name given a version code.\nAs described [here](http://developer.android.com/google/play/publishing/multiple-apks.html#VersionCodes), the official documentation proposes using a version code scheme that associates the version code and name, and also supports multiple APKs. The plugin uses that scheme but with some changes to also support Semantic Versioning.\n\nThe Semantic Version Gradle Plugin automatically generates and configures the `versionCode` and `versionName` on the `defaultConfig` section at build time. It uses the version defined at the root `build.gradle[.kts]` to configure those fields. **It's important to remember you don't have to set those fields on the `defaultConfig` section.**\n\n### Simple versioning scheme\nThanks to the introduction of the App Bundle format, in most cases, you are not going to need the multiple APKs support.\nSo you can just use a 6 digits version code that represents the semantic version: the first two digits for the `MAJOR` version, then two for the `MINOR` and the last two for the `PATCH` version.\n\n![](wiki/versioncode.png)\n\nAs you can see, you can go from version `0.0.1` to `99.99.99`. So, you have room for more than 192 years of versions, releasing weekly and without taking into account the hotfixes !!!\nThis simple versioning scheme is the default scheme on the plugin.\n\nFor Android projects, the `printVersion` task prints the project version, the android app version name \u0026 version code.\n\n```\n./gradlew printVersion\nOUTPUT:\nVersion: 1.0.0-SNAPSHOT\nVersion code: 10000\nVersion name: 1.0.0-SNAPSHOT\n```\n\nGiven that the default value of the `maximumVersion` parameter is `99`, the maximum generated version code will be `999999`. Be careful, increasing this value, impacts the generated version code, which is limited to `2100000000`\n\n## More info\n\nYou can read more details about this plugin on this [article](https://medium.com/dipien/automatic-semantic-versioning-on-your-gradle-project-6343b626b27b)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipien%2Fsemantic-version-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdipien%2Fsemantic-version-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipien%2Fsemantic-version-gradle-plugin/lists"}