|
| 1 | +<!-- Generated with https://github.com/thlorenz/doctoc --> |
| 2 | +<!-- doctoc docs/README.md > |
| 3 | +
|
| 4 | +<!-- START doctoc generated TOC please keep comment here to allow auto update --> |
| 5 | +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> |
| 6 | +**Table of Contents** |
| 7 | + |
| 8 | +- [Change Log](#change-log) |
| 9 | +- [Usage](#usage) |
| 10 | + - [Auto mode](#auto-mode) |
| 11 | + - [Manual mode](#manual-mode) |
| 12 | +- [Gradle Version Requirement](#gradle-version-requirement) |
| 13 | + |
| 14 | +<!-- END doctoc generated TOC please keep comment here to allow auto update --> |
| 15 | + |
| 16 | +Gradle plugin to auto-increments the patch version on each call to the `publish` task by looking up the most recent version published in the publishing maven repository and adds it by one. |
| 17 | + |
| 18 | +Tested to work in the following scenarios: |
| 19 | + |
| 20 | +* Single root project publication |
| 21 | +* Single and multiple subprojects publication |
| 22 | +* BOM references via `api(platform(project(":bom")))` and `java-platform` plugin |
| 23 | +* Manual versioning, prevents the task from publishing if the version isn't different from the one in maven |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +## Change Log |
| 28 | + |
| 29 | +See [releases](https://github.com/countableSet/semantic-version-plugin/releases) for changes. |
| 30 | + |
| 31 | +* 0.2.x compatible with Java 11 |
| 32 | + ** 0.2.0 set compatability to Java 11, bump dependency versions, and upgrade gradle to 8.1 |
| 33 | +* 0.1.x compatible with Java 8 |
| 34 | + ** 0.1.5 fix bug when the plugin wasn't applying correct to root projects without jars |
| 35 | + ** 0.1.4 fix bug when major or minor version was bump was computed incorrectly |
| 36 | + ** 0.1.3 adds manual mode flag to skip publishing when artifact already exists |
| 37 | + ** 0.1.2 fix bug with version finder |
| 38 | + ** 0.1.1 unknown |
| 39 | + ** 0.1.0 unknown |
| 40 | + |
| 41 | +## Usage |
| 42 | + |
| 43 | +[Plugins Portal](https://plugins.gradle.org/plugin/dev.poolside.gradle.semantic-version) |
| 44 | + |
| 45 | +```kotlin |
| 46 | +plugins { |
| 47 | + `maven-publish` |
| 48 | + id("dev.poolside.gradle.semantic-version") version "{version}" |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +```sh |
| 53 | +$ ./gradlw publish |
| 54 | +[...] |
| 55 | +> Task :semanticVersion |
| 56 | +Resolved published version of 'dev.poolside.test:my-library:0.1.4' to '0.1.5' |
| 57 | +[...] |
| 58 | +``` |
| 59 | + |
| 60 | +### Auto mode |
| 61 | + |
| 62 | +Basic full example, but it can also be used for subprojects and bom subprojects. However, make sure the publication version number is in the format of `[\d]+\.[\d]+`. |
| 63 | + |
| 64 | +```kotlin |
| 65 | +plugins { |
| 66 | + java |
| 67 | + `maven-publish` |
| 68 | + id("dev.poolside.gradle.semantic-version") version "{version}" |
| 69 | +} |
| 70 | +repositories { |
| 71 | + mavenCentral() |
| 72 | +} |
| 73 | + |
| 74 | +group = "dev.poolside.test" |
| 75 | +version = "0.1" |
| 76 | + |
| 77 | +publishing { |
| 78 | + publications { |
| 79 | + create<MavenPublication>("mavenJava") { |
| 80 | + artifactId = "my-library" |
| 81 | + from(components["java"]) |
| 82 | + } |
| 83 | + } |
| 84 | +} |
| 85 | +``` |
| 86 | + |
| 87 | +### Manual mode |
| 88 | + |
| 89 | +If there's a scenario in which you want to manually increment the semantic version. Therefore, the plugin will disable publishing if the version already exists in the repository. |
| 90 | + |
| 91 | +```kotlin |
| 92 | +semanticVersion { |
| 93 | + manual = true |
| 94 | +} |
| 95 | +``` |
| 96 | + |
| 97 | +## Gradle Version Requirement |
| 98 | + |
| 99 | +The plugin now requires Gradle version 8.11+ to access new access. |
| 100 | + |
| 101 | +```sh |
| 102 | +❯ gr semanticVersion |
| 103 | +> Task :client:semanticVersion FAILED |
| 104 | + |
| 105 | +FAILURE: Build failed with an exception. |
| 106 | + |
| 107 | +* What went wrong: |
| 108 | + Execution failed for task ':client:semanticVersion'. |
| 109 | +> org/gradle/api/internal/initialization/StandaloneDomainObjectContext |
| 110 | + |
| 111 | +* Try: |
| 112 | +> Run with --stacktrace option to get the stack trace. |
| 113 | +> Run with --info or --debug option to get more log output. |
| 114 | +> Run with --scan to get full insights. |
| 115 | +> Get more help at https://help.gradle.org. |
| 116 | + |
| 117 | +BUILD FAILED in 1s |
| 118 | +2 actionable tasks: 2 executed |
| 119 | +``` |
0 commit comments