{"id":16206942,"url":"https://github.com/javiersegoviacordoba/semver-gradle-plugin","last_synced_at":"2025-03-16T11:30:33.798Z","repository":{"id":37047466,"uuid":"423300614","full_name":"JavierSegoviaCordoba/semver-gradle-plugin","owner":"JavierSegoviaCordoba","description":"Set projects versions based on git tags and following semantic versioning","archived":false,"fork":false,"pushed_at":"2025-02-25T19:07:13.000Z","size":3195,"stargazers_count":28,"open_issues_count":3,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T01:41:22.198Z","etag":null,"topics":["cache","configuration","configuration-cache","git","git-version","gradle","gradle-plugin","hacktoberfest","kotlin","multimodule","multiproject","project-isolation","semantic-version","semantic-versioning","semver","semver-tag","versioning"],"latest_commit_sha":null,"homepage":"https://semver-gradle-plugin.javiersc.com","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JavierSegoviaCordoba.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"JavierSegoviaCordoba"}},"created_at":"2021-11-01T01:20:56.000Z","updated_at":"2025-02-25T19:07:16.000Z","dependencies_parsed_at":"2024-05-31T08:52:31.809Z","dependency_job_id":"18a193df-0f38-40c6-8bb9-ca4882f5cfd3","html_url":"https://github.com/JavierSegoviaCordoba/semver-gradle-plugin","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":"JavierSegoviaCordoba/kotlin-template-javiersc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JavierSegoviaCordoba%2Fsemver-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JavierSegoviaCordoba%2Fsemver-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JavierSegoviaCordoba%2Fsemver-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JavierSegoviaCordoba%2Fsemver-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JavierSegoviaCordoba","download_url":"https://codeload.github.com/JavierSegoviaCordoba/semver-gradle-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243862304,"owners_count":20360120,"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":["cache","configuration","configuration-cache","git","git-version","gradle","gradle-plugin","hacktoberfest","kotlin","multimodule","multiproject","project-isolation","semantic-version","semantic-versioning","semver","semver-tag","versioning"],"created_at":"2024-10-10T10:09:13.989Z","updated_at":"2025-03-16T11:30:33.772Z","avatar_url":"https://github.com/JavierSegoviaCordoba.png","language":"Kotlin","funding_links":["https://github.com/sponsors/JavierSegoviaCordoba"],"categories":[],"sub_categories":[],"readme":"![Kotlin version](https://img.shields.io/badge/kotlin-2.0.20-blueviolet?logo=kotlin\u0026logoColor=white)\n[![MavenCentral](https://img.shields.io/maven-central/v/com.javiersc.semver/semver-gradle-plugin?label=MavenCentral)](https://repo1.maven.org/maven2/com/javiersc/semver/semver-gradle-plugin/)\n[![Snapshot](https://img.shields.io/nexus/s/com.javiersc.semver/semver-gradle-plugin?server=https%3A%2F%2Foss.sonatype.org%2F\u0026label=Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/com/javiersc/semver/semver-gradle-plugin/)\n\n[![Build](https://img.shields.io/github/actions/workflow/status/JavierSegoviaCordoba/semver-gradle-plugin/build-kotlin.yaml?label=Build\u0026logo=GitHub)](https://github.com/JavierSegoviaCordoba/semver-gradle-plugin/tree/main)\n[![Coverage](https://img.shields.io/sonar/coverage/com.javiersc.gradle:semver-gradle-plugin?label=Coverage\u0026logo=SonarCloud\u0026logoColor=white\u0026server=https%3A%2F%2Fsonarcloud.io)](https://sonarcloud.io/dashboard?id=com.javiersc.gradle:semver-gradle-plugin)\n[![Quality](https://img.shields.io/sonar/quality_gate/com.javiersc.gradle:semver-gradle-plugin?label=Quality\u0026logo=SonarCloud\u0026logoColor=white\u0026server=https%3A%2F%2Fsonarcloud.io)](https://sonarcloud.io/dashboard?id=com.javiersc.gradle:semver-gradle-plugin)\n[![Tech debt](https://img.shields.io/sonar/tech_debt/com.javiersc.gradle:semver-gradle-plugin?label=Tech%20debt\u0026logo=SonarCloud\u0026logoColor=white\u0026server=https%3A%2F%2Fsonarcloud.io)](https://sonarcloud.io/dashboard?id=com.javiersc.gradle:semver-gradle-plugin)\n\n# Semver Gradle Plugin\n\nSet projects versions based on git tags and following semantic versioning.\n\nInspired on [Reckon](https://github.com/ajoberstar/reckon) but centered on supporting multi-project\nversions and combine normal stages with `snapshot` stage.\n\n### Apply the plugin\n\nIn order to support configuration cache or project isolation the plugin must be applied to each\nproject or using the settings plugin. Avoid using `allprojects` or `subprojects`.\n\n```kotlin\n// build.gradle.kts\nplugins {\n    id(\"com.javiersc.semver\") version \"$version\"\n}\n```\n\nIt is possible to apply the plugin to all projects if the plugin is applied in the `settings.gradle`\nor `settings.gradle.kts` file:\n\n```kotlin\n// settings.gradle.kts\nplugins {\n    id(\"com.javiersc.semver\") version \"$version\"\n}\n```\n\n### Examples\n\nCheck [documented examples](.docs/docs/examples)\nor [test examples](semver-project-gradle-plugin/testFunctional/resources/examples) to understand\neasily how it works.\n\n### Usage\n\nThere are three project properties which the plugin uses to detect automatically the current version\nbased on the last tag in the current branch: `semver.stage`, `semver.scope` and `semver.tagPrefix`.\n\nThey can be set via CLI, for example:\n\n```shell\n./gradlew \"-Psemver.stage=final\" \"-Psemver.scope=major\" \"-Psemver.tagPrefix=v\"\n```\n\n- `semver.stage` indicates the stage to be changed, for example, `alpha`\n- `semver.scope` indicates the scope to be changed, for example, `patch`\n- `semver.tagPrefix` is used to know which version is going to be changed based on the tag prefix,\n  for example `v`. If the projects have different tag prefix, it is necessary to disambiguate which\n  version is going to be bumped.\n- `semver.logOnlyOnRootProject` is used to log the version in the CLI only on the root project, by\n  default it is `false`. It can be useful to avoid the version log in multi-project builds. It can\n  be added to the root `gradle.properties` file to avoid passing it constantly via CLI.\n\nDefault values:\n\n|                      | **default value** | **Optional** |\n|----------------------|-------------------|--------------|\n| stage                | `auto`            | Yes*         |\n| scope                | `auto`            | Yes*         |\n| tagPrefix            | `auto`            | Yes*         |\n| logOnlyOnRootProject | `false`           | Yes*         |\n\n\u003e Depends on the use case*\n\n#### Plugin extension\n\n```kotlin\nsemver {\n    isEnabled.set(true)\n    tagPrefix.set(\"\")\n    commitsMaxCount.set(-1)\n    gitDir.set(rootDir.resolve(\".git\"))\n}\n```\n\n- Default values:\n\n|                         | **default value**         |\n|-------------------------|---------------------------|\n| **isEnabled**           | `true`                    |\n| **tagPrefix**           | ` `, empty string         |\n| **commitsMaxCount**     | `-1`                      |\n| **gitDir**              | `rootDir.resolve(\".git\")` |\n| **mapVersion** function | _calculated version_      |\n\n`tagPrefix` is used to asociate a project version with a tag prefix, and it allows having different\nversions in multi-project builds.\n\nAn example can be setting the extension prefix to `v` in a specific project A and the last tags in\nthe last commit are: `v1.0.0` and `w3.0.1`. The project A version is `v1.0.0`. If a project B sets\nthe prefix to `w`, the project B version is `w3.0.1`.\n\nIn order to improve the performance on large repositories with a lot of commits, it is possible to\nlimit the number of commits to be checked via `commitsMaxCount`. By default, it is `-1` which means\nthat all commits are checked.\n\n`semver` contains `commits: Provider\u003cList\u003cCommit\u003e\u003e` to get the commits in the current branch and the\nassociated tags to each one which can be useful in some use cases.\n\n#### `semver.tagPrefix` project property via CLI or `gradle.properties` file\n\n```shell\n\"-Psemver.tagPrefix=v\"\n```\n\n```properties\nsemver.tagPrefix=v\n```\n\nIf it is necessary to bump the project version, for example to `v3.0.2` from `v3.0.1`, but at same\ntime there are more project with different prefixes, the plugin needs to know which tag prefix is\ngoing to be bumped, so `semver.tagPrefix` property is the solution to that problem.\n\nTo get it working:\n\n```shell\n./gradlew \"-Psemver.scope=patch\" \"-Psemver.tagPrefix=v\"\n```\n\nIt is possible to set the project tag prefix via Gradle property if some third-party plugin requires\nthe version in configuration phase. This property is:\n\n```properties\nsemver.project.tagPrefix=v\n```\n\nAs it can be useful to change the number of commits to be checked, it is possible to set it via\nproperties too:\n\n```properties\nsemver.commitsMaxCount=100\n```\n\nOr in the CLI:\n\n```shell\n./gradlew \"-Psemver.commitsMaxCount=100\"\n```\n\n##### Map the version\n\nThe `semver` extension has a `mapVersion` function which allows to map the version easily:\n\n```kotlin\n// if last tag is v3.0.1, and the Kotlin version is 1.9.0,\n// the version will be `v3.0.1+1.9.0`\nsemver {\n    tagPrefix.set(\"v\")\n    mapVersion { gradleVersion: GradleVersion -\u003e\n        val kotlinVersion: String = getKotlinPluginVersion()\n        \"${gradleVersion.copy(metadata = kotlinVersion)}\"\n    }\n}\n```\n\n##### Override the version\n\n```kotlin\nsemver {\n    mapVersion { \"1.0.0\" }\n}\n```\n\n##### Additional notes\n\n###### Empty tag prefix for all projects\n\n\u003e If all projects are not using a tag prefix, or in other words, the tag prefix is empty, both the\n\u003e property in the extension and the project property via CLI or `gradle.properties` file are\n\u003e irrelevant.\n\n###### Same tag prefix for all projects\n\n\u003e If all projects share a tag prefix, it is easier to set it in the root project `gradle.properties`\n\u003e file instead of passing it constantly via CLI.\n\n### Version types\n\nThe whole format can be:\n\n```text\n\u003cmajor\u003e.\u003cminor\u003e.\u003cpatch\u003e[-\u003cstage\u003e.\u003cnum\u003e][.\u003ccommits number\u003e+\u003chash\u003e][+\u003cmetadata\u003e]\n```\n\n#### Final\n\n- Format: `\u003cmajor\u003e.\u003cminor\u003e.\u003cpatch\u003e`\n- Example: `1.0.0`\n\n#### Significant\n\n- Format: `\u003cmajor\u003e.\u003cminor\u003e.\u003cpatch\u003e[-\u003cstage\u003e.\u003cnum\u003e]`\n- Example: `1.0.0-alpha.1`\n\n#### Insignificant\n\n- Format:\n    - Clean repository: `\u003cmajor\u003e.\u003cminor\u003e.\u003cpatch\u003e[-\u003cstage\u003e.\u003cnum\u003e][.\u003ccommits number\u003e+\u003chash\u003e]`\n    - Dirty repository: `\u003cmajor\u003e.\u003cminor\u003e.\u003cpatch\u003e[-\u003cstage\u003e.\u003cnum\u003e][.\u003ccommits number\u003e+\u003cDIRTY\u003e]`\n\n- Examples:\n    - `1.0.0.4+26f0484`\n    - `1.0.0.4+DIRTY`\n\n\u003e It is used the `DIRTY` suffix instead of a timestamp in order to avoid issues with any Gradle\n\u003e cache.\n\n#### Snapshot\n\n- Format: `\u003cmajor\u003e.\u003cminor\u003e.\u003cpatch\u003e-SNAPSHOT`\n- Example: `1.0.0-SNAPSHOT`\n\n### Stages\n\nTo change between stages, use the Gradle project property `-Psemver.stage=\u003cstage\u003e`\n\nThere are reserved stages that can be used to create certain versions:\n\n- `final`: It creates a version without a suffix stage, for example, `1.0.1`.\n- `auto`: It calculates automatically the next stage based on the previous stage.\n- `snapshot`: It generate the next snapshot version, for example, `1.0.1-SNAPSHOT`.\n\n```properties\n# gradle.properties\nsemver.tagPrefix=v\n```\n\n```shell\n# Last tag = v1.0.0-alpha.1\n./gradlew \"-Psemver.stage=alpha\" # v1.0.0-alpha.2\n./gradlew \"-Psemver.stage=beta\" # v1.0.0-beta.1\n./gradlew \"-Psemver.stage=rc\" # v1.0.0-rc.1\n./gradlew \"-Psemver.stage=snapshot\" # v1.0.1-SNAPSHOT (uses the next patch version)\n./gradlew \"-Psemver.stage=final\" # v1.0.0\n./gradlew \"-Psemver.stage=auto\" # v1.0.0-alpha.2\n\n# Last tag = v1.0.0\n./gradlew \"-Psemver.stage=alpha\" # v1.0.1-alpha.1\n./gradlew \"-Psemver.stage=beta\" # v1.0.1-beta.1\n./gradlew \"-Psemver.stage=rc\" # v1.0.1-rc.1\n./gradlew \"-Psemver.stage=snapshot\" # v1.0.1-SNAPSHOT (still uses the same patch version)\n./gradlew \"-Psemver.stage=final\" # v1.0.1\n./gradlew \"-Psemver.stage=auto\" # v1.0.1\n```\n\nThe stage order is based on the Gradle official rules, some samples are:\n\n- If both are non-numeric, the parts are compared alphabetically, in a case-sensitive manner:\n  `1.0.0-ALPHA.1` \u003c `1.0.0-BETA.1` \u003c `1.0.0-alpha.1` \u003c `1.0.0-beta.1`.\n- `dev` is considered lower than any non-numeric\n  part: `1.0.0-dev.1` \u003c `1.0.0-ALPHA.1` \u003c `1.0.0-alpha.1` \u003c `1.0.0-rc.1`.\n- The strings `rc`, `snapshot`, `final`, `ga`, `release` and `sp` are considered higher than any\n  other string part (sorted in this order): `1.0.0-zeta.1` \u003c `1.0.0-rc.1` \u003c `1.0.0-snapshot` \u003c\n  `1.0.0-ga.1` \u003c `1.0.0-release.1` \u003c `1.0.0-sp.1` \u003c `1.0.0`.\n- These particular values are NOT case-sensitive, as opposed to regular string parts and do not\n  depend on the separator used around them: `1.0.0-RC.1` == `1.0.0-rc.1`.\n\nGradle's docs can be\nfound [here](https://docs.gradle.org/current/userguide/single_versions.html#version_ordering)\n\n### Scopes\n\nTo change between scopes, use the Gradle property `-Psemver.scope=\u003cscope\u003e`\n\nThe scope has to be one of `major`, `minor`, `patch` or `auto`.\n\n```properties\n# gradle.properties\nsemver.tagPrefix=v\n```\n\n```shell\n# Last tag = v1.0.0-alpha.1\n./gradlew \"-Psemver.scope=major\" # v2.0.0\n./gradlew \"-Psemver.scope=minor\" # v1.1.0\n./gradlew \"-Psemver.scope=patch\" # v1.0.1\n./gradlew \"-Psemver.scope=auto\" # v1.0.0-alpha.2 (uses the next num version)\n\n# Last tag = v1.0.0\n./gradlew \"-Psemver.scope=major\" # v2.0.0\n./gradlew \"-Psemver.scope=minor\" # v1.1.0\n./gradlew \"-Psemver.scope=patch\" # v1.0.1\n./gradlew \"-Psemver.scope=auto\" # v1.0.1 (uses the next patch version)\n```\n\n### Combine stages and scopes\n\n```properties\n# gradle.properties\nsemver.tagPrefix=v\n```\n\n```shell\n# Last tag = v1.0.0-alpha.1\n./gradlew \"-Psemver.stage=alpha\" \"-Psemver.scope=major\" # v2.0.0-alpha.1\n./gradlew \"-Psemver.stage=beta\" \"-Psemver.scope=major\" # v2.0.0-beta.1\n./gradlew \"-Psemver.stage=rc\" \"-Psemver.scope=major\" # v2.0.0-rc.1\n./gradlew \"-Psemver.stage=final\" \"-Psemver.scope=major\" # v2.0.0\n./gradlew \"-Psemver.stage=snapshot\" \"-Psemver.scope=major\" # v2.0.0-SNAPSHOT\n./gradlew \"-Psemver.stage=auto\" \"-Psemver.scope=auto\" # v1.0.0-alpha.2\n\n# Last tag = v1.0.0-alpha.1\n./gradlew \"-Psemver.stage=alpha\" \"-Psemver.scope=minor\" # v1.1.0-alpha.1\n./gradlew \"-Psemver.stage=beta\" \"-Psemver.scope=minor\" # v1.1.0-beta.1\n./gradlew \"-Psemver.stage=rc\" \"-Psemver.scope=minor\" # v1.1.0-rc.1\n./gradlew \"-Psemver.stage=final\" \"-Psemver.scope=minor\" # v1.1.0\n./gradlew \"-Psemver.stage=snapshot\" \"-Psemver.scope=minor\" # v1.1.0-SNAPSHOT\n\n# Last tag = v1.0.0-alpha.1\n./gradlew \"-Psemver.stage=alpha\" \"-Psemver.scope=patch\" # v1.0.1-alpha.1\n./gradlew \"-Psemver.stage=beta\" \"-Psemver.scope=patch\" # v1.0.1-beta.1\n./gradlew \"-Psemver.stage=rc\" \"-Psemver.scope=patch\" # v1.0.1-rc.1\n./gradlew \"-Psemver.stage=final\" \"-Psemver.scope=patch\" # v1.0.1\n./gradlew \"-Psemver.stage=snapshot\" \"-Psemver.scope=patch\" # v1.0.1-SNAPSHOT\n\n# Last tag = v1.0.0-alpha.1\n./gradlew \"-Psemver.stage=alpha\" \"-Psemver.scope=auto\" # v1.0.0-alpha.2\n./gradlew \"-Psemver.stage=beta\" \"-Psemver.scope=auto\" # v1.0.1-beta.1\n./gradlew \"-Psemver.stage=rc\" \"-Psemver.scope=auto\" # v1.0.1-rc.1\n./gradlew \"-Psemver.stage=final\" \"-Psemver.scope=auto\" # v1.0.1\n./gradlew \"-Psemver.stage=snapshot\" \"-Psemver.scope=auto\" # v1.0.1-SNAPSHOT\n\n# Last tag = v1.0.0\n./gradlew \"-Psemver.stage=alpha\" \"-Psemver.scope=major\" # v2.0.0-alpha.1\n./gradlew \"-Psemver.stage=beta\" \"-Psemver.scope=major\" # v2.0.0-beta.1\n./gradlew \"-Psemver.stage=rc\" \"-Psemver.scope=major\" # v2.0.0-rc.1\n./gradlew \"-Psemver.stage=final\" \"-Psemver.scope=major\" # v2.0.0\n./gradlew \"-Psemver.stage=snapshot\" \"-Psemver.scope=major\" # v2.0.0-SNAPSHOT\n./gradlew \"-Psemver.stage=auto\" \"-Psemver.scope=auto\" # v1.0.1\n\n# Last tag = v1.0.0\n./gradlew \"-Psemver.stage=alpha\" \"-Psemver.scope=minor\" # v1.1.0-alpha.1\n./gradlew \"-Psemver.stage=beta\" \"-Psemver.scope=minor\" # v1.1.0-beta.1\n./gradlew \"-Psemver.stage=rc\" \"-Psemver.scope=minor\" # v1.1.0-rc.1\n./gradlew \"-Psemver.stage=final\" \"-Psemver.scope=minor\" # v1.1.0\n./gradlew \"-Psemver.stage=snapshot\" \"-Psemver.scope=minor\" # v1.1.0-SNAPSHOT\n\n# Last tag = v1.0.0\n./gradlew \"-Psemver.stage=alpha\" \"-Psemver.scope=patch\" # v1.0.1-alpha.1\n./gradlew \"-Psemver.stage=beta\" \"-Psemver.scope=patch\" # v1.0.1-beta.1\n./gradlew \"-Psemver.stage=rc\" \"-Psemver.scope=patch\" # v1.0.1-rc.1\n./gradlew \"-Psemver.stage=final\" \"-Psemver.scope=patch\" # v1.0.1\n./gradlew \"-Psemver.stage=snapshot\" \"-Psemver.scope=patch\" # v1.0.1-SNAPSHOT\n\n# Last tag = v1.0.0\n./gradlew \"-Psemver.stage=alpha\" \"-Psemver.scope=auto\" # v1.0.1-alpha.1\n./gradlew \"-Psemver.stage=beta\" \"-Psemver.scope=auto\" # v1.0.1-beta.1\n./gradlew \"-Psemver.stage=rc\" \"-Psemver.scope=auto\" # v1.0.1-rc.1\n./gradlew \"-Psemver.stage=final\" \"-Psemver.scope=auto\" # v1.0.1\n./gradlew \"-Psemver.stage=snapshot\" \"-Psemver.scope=auto\" # v1.0.1-SNAPSHOT\n```\n\n### Tasks\n\nThere are three tasks:\n\n- `printSemver`: Prints the tag in CLI and create a file in `build/semver/version.txt` which has two\n  lines; the version without the tag and the version including the tag.\n- `createSemverTag`. Creates a git tag.\n- `pushSemverTag`. Creates and pushes a git tag to the remote.\n\nYou can combine them with any `semver` project properties to ensure the correct tag version is\nprinted, created or pushed.\n\n`pushSemverTag` can use a specific remote if the Gradle property `semver.remote` is set. If it is\nnot set, `origin` is used if it exists, if not, the first remote by name is used. If there is no\nremote, the task fails.\n\nSamples:\n\n```shell\n./gradlew createSemverTag\n\n./gradlew createSemverTag \"-Psemver.stage=alpha\"\n\n./gradlew pushSemverTag\n\n./gradlew pushSemverTag \"-Psemver.stage=alpha\"\n```\n\n### Set versions without `DIRTY` suffix on dirty repositories\n\nBy default, if the repository status is not clean, the version shows the suffix `DIRTY` but that can\nbe avoided by setting the Gradle property `semver.checkClean`.\n\nFor example, if the last tag is `1.0.0`, there are 23 commits between that tag and the last commit\nand the repo is not clean:\n\n```shell\n./gradlew \"-Psemver.stage=final\" \"-Psemver.scope=patch\"\n\nsemver: 1.0.0.23+DIRTY\n```\n\n```shell\n./gradlew \"-Psemver.stage=final\" \"-Psemver.scope=patch\" \"-Psemver.checkClean=false\"\nsemver: 1.0.1\n```\n\n```shell\n./gradlew \"-Psemver.checkClean=false\"\nsemver: 1.0.0.23+1a2cd5b2 # 1a2cd5b2 is the last commit hash\n```\n\n### FAQ\n\n#### Included builds support\n\nThe plugin supports included builds, but it is necessary to specify the `.git` directory as there is\nno reliable way to get the `.git` directory from the main build in the included build.\n\nThere are two ways to specify the `.git` directory\n\n- On all projects `build.gradle.kts`\n- In the `settings.gradle.kts`\n\nExample for the next project structure:\n\n```markdown\nroot/\n├── settings.gradle.kts\n└── build-logic/\n    └── settings.gradle.kts\n```\n\nSpecify the `.git` directory in the `build-logic/settings.gradle.kts` file:\n\n```kotlin\nsemver {\n    gitDir.set(rootDir.parentFile.resolve(\".git\"))\n}\n```\n\n---\n\n#### `mapVersion` function workaround on Groovy\n\nDue to calling `mapVersion` in Groovy, it is possible to get the error:\n\n- https://github.com/gradle/gradle/issues/30830\n\n```\nCould not serialize value of type $Proxy96\n```\n\nBeing `96` a random number.\n\nThe *workaround* is:\n\n```groovy\nclass SemverWorkaround {\n    static mapper = new VersionMapper() {\n        @Override\n        String map(GradleVersion gradleVersion) {\n            \"2.0.0\"\n        }\n    }\n}\n\nsemver {\n    mapVersion SemverWorkaround.mapper\n}\n```\n\nIt works on settings and project script files.\n\n---\n\n## License\n\n```\nCopyright 2024 Javier Segovia Córdoba\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaviersegoviacordoba%2Fsemver-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaviersegoviacordoba%2Fsemver-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaviersegoviacordoba%2Fsemver-gradle-plugin/lists"}