diff --git a/.circleci/config.yml b/.circleci/config.yml
index 64d62be..65723f0 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,54 +1,41 @@
-version: 2
+inversion: 2
defaults: &defaults
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
TERM: dumb
- CI: true
+ CI_NAME: "CircleCI"
-defaults_gradle: &defaults_gradle
+defaults_gradle: &defaults_bld
steps:
- checkout
- - restore_cache:
- keys:
- - gradle-dependencies-{{ checksum "build.gradle.kts" }}
- # fallback to using the latest cache if no exact match is found
- - gradle-dependencies-
- run:
- name: Gradle Dependencies
- command: ./gradlew dependencies
- - save_cache:
- paths: ~/.m2
- key: gradle-dependencies-{{ checksum "build.gradle.kts" }}
+ name: Download the dependencies
+ command: ./bld download
- run:
- name: Run All Checks
- command: ./gradlew check
- - store_artifacts:
- path: build/reports/
- destination: reports
- - store_test_results:
- path: build/reports/
+ name: Run tests with bld
+ command: ./bld compile test
jobs:
- build_gradle_jdk17:
+ bld_jdk20:
+ <<: *defaults
+
+ docker:
+ - image: cimg/openjdk:20.0
+
+ <<: *defaults_bld
+
+ bld_jdk17:
<<: *defaults
docker:
- image: cimg/openjdk:17.0
- <<: *defaults_gradle
-
- build_gradle_jdk11:
- <<: *defaults
-
- docker:
- - image: cimg/openjdk:11.0
-
- <<: *defaults_gradle
+ <<: *defaults_bld
workflows:
version: 2
- gradle:
+ bld:
jobs:
- - build_gradle_jdk20
- - build_gradle_jdk17
+ - bld_jdk17
+ - bld_jdk20
diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml
new file mode 100644
index 0000000..79093d1
--- /dev/null
+++ b/.github/workflows/bld.yml
@@ -0,0 +1,53 @@
+name: bld-ci
+
+on: [ push, pull_request, workflow_dispatch ]
+
+jobs:
+ build-bld-project:
+ runs-on: ubuntu-latest
+
+ env:
+ COVERAGE_SDK: "17"
+
+ strategy:
+ matrix:
+ java-version: [ 17, 20 ]
+
+ steps:
+ - name: Checkout source repository
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set up JDK ${{ matrix.java-version }}
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'zulu'
+ java-version: ${{ matrix.java-version }}
+
+ - name: Grant execute permission for bld
+ run: chmod +x bld
+
+ - name: Download the dependencies
+ run: ./bld download
+
+ - name: Run tests with bld
+ run: ./bld compile jacoco
+
+ - name: Remove pom.xml
+ if: success() && matrix.java-version == env.COVERAGE_SDK
+ run: rm -rf pom.xml
+
+ - name: SonarCloud Scan
+ uses: sonarsource/sonarcloud-github-action@master
+ if: success() && matrix.java-version == env.COVERAGE_SDK
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+
+ - name: Upload coverage reports to Codecov
+ uses: codecov/codecov-action@v3
+ if: success() && matrix.java-version == env.COVERAGE_SDK
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+
diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
deleted file mode 100644
index 13384a8..0000000
--- a/.github/workflows/gradle.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-name: gradle-ci
-
-on: [ push, pull_request, workflow_dispatch ]
-
-jobs:
- build:
- runs-on: ubuntu-latest
-
- env:
- GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m"
- SONAR_JDK: "17"
-
- strategy:
- matrix:
- java-version: [ 17, 20 ]
-
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Set up JDK ${{ matrix.java-version }}
- uses: actions/setup-java@v3
- with:
- distribution: 'zulu'
- java-version: ${{ matrix.java-version }}
-
- - name: Grant execute permission for gradlew
- run: chmod +x gradlew
-
- - name: Cache SonarCloud packages
- if: matrix.java-version == env.SONAR_JDK
- uses: actions/cache@v3
- with:
- path: ~/.sonar/cache
- key: ${{ runner.os }}-sonar
- restore-keys: ${{ runner.os }}-sonar
-
- - name: Test with Gradle
- uses: gradle/gradle-build-action@v2
- with:
- arguments: build check --stacktrace
-
- - name: SonarCloud
- if: success() && matrix.java-version == env.SONAR_JDK
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- run: ./gradlew sonar --info
diff --git a/.gitignore b/.gitignore
index 097f727..091e664 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,84 +1,57 @@
-
-!.vscode/extensions.json
-!.vscode/launch.json
-!.vscode/settings.json
-!.vscode/tasks.json
-*.class
-*.code-workspace
-*.ctxt
-*.iws
-*.log
-*.nar
-*.rar
-*.sublime-*
-*.tar.gz
-*.zip
-.DS_Store
-.classpath
.gradle
-.history
-.kobalt
-.mtj.tmp/
-.mvn/timing.properties
-.mvn/wrapper/maven-wrapper.jar
-.nb-gradle
-.project
-.scannerwork
-.settings
-.vscode/*
-/**/.idea/$CACHE_FILE$
-/**/.idea/$PRODUCT_WORKSPACE_FILE$
-/**/.idea/**/caches/build_file_checksums.ser
-/**/.idea/**/contentModel.xml
-/**/.idea/**/dataSources.ids
-/**/.idea/**/dataSources.local.xml
-/**/.idea/**/dataSources/
-/**/.idea/**/dbnavigator.xml
-/**/.idea/**/dictionaries
-/**/.idea/**/dynamic.xml
-/**/.idea/**/gradle.xml
-/**/.idea/**/httpRequests
-/**/.idea/**/libraries
-/**/.idea/**/mongoSettings.xml
-/**/.idea/**/replstate.xml
-/**/.idea/**/shelf
-/**/.idea/**/shelf/
-/**/.idea/**/sqlDataSources.xml
-/**/.idea/**/tasks.xml
-/**/.idea/**/uiDesigner.xml
-/**/.idea/**/usage.statistics.xml
-/**/.idea/**/workspace.xml
-/**/.idea/sonarlint*
-/**/.idea_modules/
-Thumbs.db
-__pycache__
+.DS_Store
+build
+lib/bld/**
+!lib/bld/bld-wrapper.properties
+!lib/bld/bld-wrapper.jar
+lib/compile/
+lib/runtime/
+lib/standalone/
+lib/test/
+
+# IDEA ignores
+
+# User-specific
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# AWS User-specific
+.idea/**/aws.xml
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
atlassian-ide-plugin.xml
-bin/
-build/
-cmake-build-*/
-com_crashlytics_export_strings.xml
-crashlytics-build.properties
-crashlytics.properties
-dependency-reduced-pom.xml
-deploy/
-dist/
-ehthumbs.db
-fabric.properties
-gen/
-hs_err_pid*
-kobaltBuild
-kobaltw*-test
-lib/kotlin*
-libs/
-local.properties
-out/
-pom.xml.next
-pom.xml.releaseBackup
-pom.xml.tag
-pom.xml.versionsBackup
-proguard-project.txt
-project.properties
-release.properties
-target/
-test-output
-venv
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# SonarLint plugin
+.idea/sonarlint/
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+local.properties
\ No newline at end of file
diff --git a/.idea/app.iml b/.idea/app.iml
new file mode 100644
index 0000000..787b59b
--- /dev/null
+++ b/.idea/app.iml
@@ -0,0 +1,29 @@
+
+
-
-
GeneratedVersion
class containing the semantic
+version (major, minor, patch, etc.) that is read from a Properties file or defined in the annotation.
+
+@since 1.0
+
+
diff --git a/bin/main/semver-kt.mustache b/bin/main/semver-kt.mustache
new file mode 100644
index 0000000..0a58f86
--- /dev/null
+++ b/bin/main/semver-kt.mustache
@@ -0,0 +1,38 @@
+/*
+* This file is automatically generated.
+* Do not modify! -- ALL CHANGES WILL BE ERASED!
+*/
+
+package {{packageName}}
+
+import java.util.Date
+
+/**
+* Provides semantic version information.
+*
+* @author Semantic Version Annotation Processor
+*/
+object {{className}} {
+@JvmField
+val PROJECT = "{{project}}"
+@JvmField
+val BUILDDATE = Date({{epoch}}L)
+@JvmField
+val MAJOR = {{major}}
+@JvmField
+val MINOR = {{minor}}
+@JvmField
+val PATCH = {{patch}}
+@JvmField
+val PRERELEASE = "{{preRelease}}"
+@JvmField
+val PRERELEASE_PREFIX = "{{preReleasePrefix}}"
+@JvmField
+val BUILDMETA = "{{buildMeta}}"
+@JvmField
+val BUILDMEATA_PREFIX = "{{buildMetaPrefix}}"
+@JvmField
+val SEPARATOR = "{{separator}}"
+@JvmField
+val VERSION = "{{version}}"
+}
diff --git a/bin/main/semver.mustache b/bin/main/semver.mustache
new file mode 100644
index 0000000..cd7c567
--- /dev/null
+++ b/bin/main/semver.mustache
@@ -0,0 +1,34 @@
+/*
+* This file is automatically generated.
+* Do not modify! -- ALL CHANGES WILL BE ERASED!
+*/
+
+package {{packageName}};
+
+import java.util.Date;
+
+/**
+* Provides semantic version information.
+*
+* @author Semantic Version Annotation Processor
+*/
+public final class {{className}} {
+public static final String PROJECT = "{{project}}";
+public static final Date BUILDDATE = new Date({{epoch}}L);
+public static final int MAJOR = {{major}};
+public static final int MINOR = {{minor}};
+public static final int PATCH = {{patch}};
+public static final String PRERELEASE = "{{preRelease}}";
+public static final String PRERELEASE_PREFIX = "{{preReleasePrefix}}";
+public static final String BUILDMETA = "{{buildMeta}}";
+public static final String BUILDMETA_PREFIX = "{{buildMetaPrefix}}";
+public static final String SEPARATOR = "{{separator}}";
+public static final String VERSION = "{{version}}";
+
+/**
+* Disables the default constructor.
+*/
+private {{className}}() {
+throw new UnsupportedOperationException("Illegal constructor call.");
+}
+}
diff --git a/bin/test/net/thauvin/erik/semver/ConstantsTest.class b/bin/test/net/thauvin/erik/semver/ConstantsTest.class
new file mode 100644
index 0000000..c8c9fde
Binary files /dev/null and b/bin/test/net/thauvin/erik/semver/ConstantsTest.class differ
diff --git a/bin/test/net/thauvin/erik/semver/VersionInfoTest.class b/bin/test/net/thauvin/erik/semver/VersionInfoTest.class
new file mode 100644
index 0000000..8c5f8b4
Binary files /dev/null and b/bin/test/net/thauvin/erik/semver/VersionInfoTest.class differ
diff --git a/bin/test/net/thauvin/erik/semver/VersionProcessorTest.class b/bin/test/net/thauvin/erik/semver/VersionProcessorTest.class
new file mode 100644
index 0000000..5166fb7
Binary files /dev/null and b/bin/test/net/thauvin/erik/semver/VersionProcessorTest.class differ
diff --git a/bin/test/net/thauvin/erik/semver/VersionTest.class b/bin/test/net/thauvin/erik/semver/VersionTest.class
new file mode 100644
index 0000000..0047ff2
Binary files /dev/null and b/bin/test/net/thauvin/erik/semver/VersionTest.class differ
diff --git a/bld b/bld
new file mode 100755
index 0000000..824b742
--- /dev/null
+++ b/bld
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build net.thauvin.erik.semver.SemverBuild "$@"
\ No newline at end of file
diff --git a/bld.bat b/bld.bat
new file mode 100644
index 0000000..ab43bcd
--- /dev/null
+++ b/bld.bat
@@ -0,0 +1,4 @@
+@echo off
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build net.thauvin.erik.semver.SemverBuild %*
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index 478fc4b..0000000
--- a/build.gradle
+++ /dev/null
@@ -1,221 +0,0 @@
-// import com.github.spotbugs.snom.SpotBugsTask
-import org.apache.tools.ant.taskdefs.condition.Os
-
-plugins {
- id 'java'
- id 'jacoco'
- id 'maven-publish'
- id 'pmd'
- id 'signing'
- id 'com.github.ben-manes.versions' version '0.47.0'
- id 'net.thauvin.erik.gradle.semver' version '1.0.4'
- // id 'com.github.spotbugs' version '5.0.14'
- id 'org.sonarqube' version '4.2.1.3168'
-}
-
-defaultTasks 'check'
-
-group = 'net.thauvin.erik'
-
-final def mavenName = 'SemVer'
-final def mavenDescription = 'Semantic Version Annotation Processor'
-final def mavenUrl = 'https://github.com/ethauvin/semver'
-final def mavenLicense = 'The BSD 3-Clause License'
-final def mavenLicenseUrl = 'http://opensource.org/licenses/BSD-3-Clause'
-final def mavenScmCon = 'https://github.com/ethauvin/semver.git'
-final def mavenScmDevCon = 'git@github.com:ethauvin/semver.git'
-
-def isNonStable = { String version ->
- def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
- def regex = /^[0-9,.v-]+(-r)?$/
- return !stableKeyword && !(version ==~ regex)
-}
-
-ext.versions = [
- pmd: '6.54.0',
- // spotbugs: '4.7.3'
-]
-
-repositories {
- mavenLocal()
- mavenCentral()
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
-}
-
-dependencies {
- implementation 'com.github.spullara.mustache.java:compiler:0.9.10'
-
- // spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0'
- // spotbugsPlugins 'com.mebigfatguy.sb-contrib:sb-contrib:7.6.0'
-
- // compileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs"
- // testCompileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs"
-
- testImplementation 'org.testng:testng:7.8.0'
-}
-
-
-tasks.withType(JavaCompile) {
- options.encoding = 'UTF-8'
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_17
- targetCompatibility = JavaVersion.VERSION_17
- withSourcesJar()
- withJavadocJar()
-}
-
-tasks.named("dependencyUpdates").configure {
- rejectVersionIf {
- isNonStable(it.candidate.version)
- }
-}
-
-pmd {
- toolVersion = versions.pmd
- ignoreFailures = true
- ruleSets = []
- ruleSetFiles = files("${projectDir}/config/pmd.xml")
- consoleOutput = true
-}
-
-publishing {
- publications {
- mavenJava(MavenPublication) {
- from components.java
- groupId = project.group
- artifactId = rootProject.name
-
- pom {
- name = mavenName
- description = mavenDescription
- url = mavenUrl
- licenses {
- license {
- name = mavenLicense
- url = mavenLicenseUrl
- }
- }
- developers {
- developer {
- id = 'ethauvin'
- name = 'Erik C. Thauvin'
- email = 'erik@thauvin.net'
- url = 'https://erik.thauvin.net/'
- }
- }
- scm {
- connection = 'scm:git:' + mavenScmCon
- developerConnection = 'scm:git:' + mavenScmDevCon
- url = mavenUrl
- }
- }
- }
- }
- repositories {
- maven {
- name = 'ossrh'
- project.afterEvaluate {
- url = project.version.contains('SNAPSHOT')
- ? 'https://oss.sonatype.org/content/repositories/snapshots/'
- : 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
- }
- credentials(PasswordCredentials)
- }
- }
-}
-
-signing {
- useGpgCmd()
- sign publishing.publications.mavenJava
-}
-
-javadoc {
- doFirst {
- title = "$mavenDescription $project.version API"
- }
- options.with {
- source = '17'
- tags = ['created']
- author = true
- //addBooleanOption('html4', true)
- links('https://docs.oracle.com/en/java/javase/17/docs/api/')
- //addStringOption('Xdoclint:none', '-quiet')
- }
-}
-
-test {
- testLogging {
- exceptionFormat = 'full'
- events('passed', 'skipped', 'failed')
- }
-
- useTestNG()
-
- finalizedBy jacocoTestReport
-}
-
-// spotbugs {
-// toolVersion.set("${versions.spotbugs}")
-// excludeFilter.set(file("$projectDir/config/spotbugs/excludeFilter.xml"))
-// }
-
-// tasks.withType(SpotBugsTask).configureEach {
-// reports {
-// xml.required = false
-// html.required = true
-// }
-// }
-
-tasks.register('release') {
- group = 'Publishing'
- description = 'Releases new version to local maven repository.'
- dependsOn(wrapper, clean, publishToMavenLocal)
- doFirst {
- println "Version: $version"
- }
-}
-
-tasks.register('pandoc', Exec) {
- group = 'Documentation'
- def pandoc_args = ['--from', 'gfm',
- '--to', 'html5',
- '--metadata', "pagetitle=$mavenDescription",
- '-s',
- '-c', 'github-pandoc.css',
- '-o', 'docs/README.html',
- 'README.md']
- if (Os.isFamily(Os.FAMILY_WINDOWS)) {
- commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
- } else {
- executable = 'pandoc'
- args(pandoc_args)
- }
- standardOutput = new ByteArrayOutputStream()
- ext.output = {
- return standardOutput.toString()
- }
-}
-
-jacocoTestReport {
- dependsOn test
- reports {
- xml.required = true
- html.required = true
- }
-}
-
-
-sonarqube {
- properties {
- property('sonar.organization', 'ethauvin-github')
- property('sonar.projectKey', 'ethauvin_semver')
- property('sonar.host.url', 'https://sonarcloud.io')
- property('sonar.sourceEncoding', 'UTF-8')
- }
-}
-
-tasks.sonar {
- dependsOn 'jacocoTestReport'
-}
diff --git a/config/pmd.xml b/config/pmd.xml
index e23c3fa..add20da 100644
--- a/config/pmd.xml
+++ b/config/pmd.xml
@@ -25,7 +25,6 @@
An annotation processor that automatically generates a GeneratedVersion
class based on a Mustache template and containing the semantic version (major, minor, patch, etc.) that is read from a Properties file or defined in the annotation.
This processor was inspired by Cédric Beust's version-processor and works well in conjunction with the Semantic Version Plugin for Gradle.
+An annotation
+processor that automatically generates a
+GeneratedVersion
class based on a Mustache template and containing
+the semantic version (major, minor,
+patch, etc.) that is read from a Properties
+file or defined in the annotation.
This processor was inspired by Cédric Beust's version-processor +and works well in conjunction with the Semantic +Version Plugin for Gradle.
import net.thauvin.erik.semver.Version;
-
-@Version(major = 1, minor = 0, patch = 0, preRelease = "beta")
-public class A {
-// ...
import net.thauvin.erik.semver.Version;
+
+@Version(major = 1, minor = 0, patch = 0, preRelease = "beta")
+public class A {
+// ...
import net.thauvin.erik.semver.Version;
-
-@Version(properties = "version.properties")
-public class A {
-// ...
import net.thauvin.erik.semver.Version;
+
+@Version(properties = "version.properties")
+public class A {
+// ...
# version.properties
+version.major=1
+version.minor=0
+version.patch=0
+version.prerelease=beta
Upon running the annotation processor, a source file GeneratedVersion.java is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable Mustache template.
-To use your own template, simply create a version.mustache
file in the project's root directory. The processor will automatically look for it.
Upon running the annotation processor, a source file GeneratedVersion.java +is automatically generated with static methods to access the semantic +version data. The source is based on a fully customizable Mustache template.
+To use your own template, simply create a
+version.mustache
file in the project's root directory. The
+processor will automatically look for it.
To specify your own template name, use:
- +@Version(template = "version.mustache")
+public class A {
+// ...
The default template implements the following static variables:
+The default +template implements the following static variables:
BUILDDATE |
The build date. | -java.util.Date |
+java.util.Date |
VERSION |
@@ -203,17 +273,19 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
A very simple custom template might look something like:
-/* version.mustache */
-package {{packageName}};
-
-import java.util.Date;
-
-public final class {{className}} {
- public final static String PROJECT = "{{project}}";
- public final static Date DATE = new Date({{epoch}}L);
- public final static String VERSION = "{{semver}}";
-}
The mustache variables automatically filled in by the processor are:
+/* version.mustache */
+package {{packageName}};
+
+import java.util.Date;
+
+public final class {{className}} {
+public final static String PROJECT = "{{project}}";
+ public final static Date DATE = new Date({{epoch}}L);
+ public final static String VERSION = "{{semver}}";
+ }
The mustache variables automatically filled in by the processor +are:
String |
|||
{{semver}} or {{version}} |
+{{semver}} or
+{{version}} |
The full semantic version. | String |
Please also look at this example using java.time
Please also look at this example
+using java.time
The following annotation elements and properties are available:
preReleasePrefix |
-version.prerelease.prefix |
+version.prerelease.prefix |
The pre-release prefix. | - |
type |
- | Either java or kt for Kotlin. |
+Either java or
+kt for Kotlin. |
java |
In order to easily incorporate with existing projects, the property keys may be assigned custom values:
-@Version(
- properties = "example.properties",
- keysPrefix = "example."
- majorKey = "maj",
- minorKey = "min",
- patchKey = "build",
- preReleaseKey = "rel",
- buildMetaKey = "meta",
- projectKey = "project"
-)
-public class Example {
-// ...
# example.properties
-example.project=Example
-example.maj=1
-example.min=0
-example.build=0
-example.rel=beta
-example.meta=
-# ...
In order to easily incorporate with existing projects, the property +keys may be assigned custom values:
+@Version(
+= "example.properties",
+ properties = "example."
+ keysPrefix = "maj",
+ majorKey = "min",
+ minorKey = "build",
+ patchKey = "rel",
+ preReleaseKey = "meta",
+ buildMetaKey = "project"
+ projectKey )
+public class Example {
+// ...
# example.properties
+example.project=Example
+example.maj=1
+example.min=0
+example.build=0
+example.rel=beta
+example.meta=
+# ...
-⚠️
+keysPrefix
is a new element staring in1.1.0
and may break older versions when using custom property keys.
-⚡ A quick fix is to includekeysPrefix=""
in the annotation to remove the defaultversion.
prefix.⚠️ +
keysPrefix
is a new element staring in1.1.0
+and may break older versions when using custom property keys.
+⚡ A quick fix is to include +keysPrefix=""
in the annotation to remove the default +version.
prefix.
To install and run from Maven, configure an artifact as follows:
-<dependency>
- <groupId>net.thauvin.erik</groupId>
- <artifactId>semver</artifactId>
- <version>1.2.0</version>
-</dependency>
Please look at pom.xml in the examples/java directory for a sample:
- +To install and run from Maven, configure an artifact as +follows:
+dependency>
+ <groupId>net.thauvin.erik</groupId>
+ <artifactId>semver</artifactId>
+ <version>1.2.0</version>
+ <dependency> </
Please look at pom.xml +in the examples/java +directory for a sample:
+mvn verify
To install and run from Gradle, add the following to build.gradle:
-dependencies {
- annotationProcessor 'net.thauvin.erik:semver:1.2.0'
- compileOnly 'net.thauvin.erik:semver:1.2.0'
-}
-
-tasks.withType(JavaCompile) {
- options.compilerArgs += [ "-Asemver.project.dir=$projectDir" ]
-}
-
-The directory containing the configuration files (version.properties
, version.mustache
) must be specified using the semver.project.dir
processor argument.
The GeneratedVersion.java
class will be automatically created in the build/generated
directory upon compiling.
Please look at build.gradle in the examples/java directory for a sample.
+To install and run from Gradle, add +the following to build.gradle:
+{
+ repositories mavenCentral()
+ }
+
+{
+ dependencies 'net.thauvin.erik:semver:1.2.0'
+ annotationProcessor 'net.thauvin.erik:semver:1.2.0'
+ compileOnly }
+
+.withType(JavaCompile) {
+ tasks.compilerArgs += [ "-Asemver.project.dir=$projectDir" ]
+ options}
The directory containing the configuration files
+(version.properties
, version.mustache
) must be
+specified using the semver.project.dir
processor
+argument.
The GeneratedVersion.java
+class will be automatically created in the build/generated
+directory upon compiling.
Please look at build.gradle +in the examples/java +directory for a sample.
In order to also incorporate the generated source code into the source tree
, add the following to build.gradle:
tasks.withType(JavaCompile) {
- options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java")
-}
-
-The GeneratedVersion.java
file will now be located in src/generated
.
In order to also incorporate the generated source code into the
+source tree
, add the following to build.gradle:
.withType(JavaCompile) {
+ tasks.generatedSourceOutputDirectory.set(file("${projectDir}/src/generated/java"))
+ options}
The GeneratedVersion.java
+file will now be located in src/generated
.
The annotation processor also supports Kotlin.
-To generate a Kotlin version file, simply specify the type
as follows:
import net.thauvin.erik.semver.Version
-
-@Version(properties = "version.properties", type="kt")
-open class Main {
-// ...
The Kotlin default template implements the same static fields and functions as the Java template.
-Please look at the examples/kotlin project for a build.gradle.kts sample.
+The annotation processor also supports Kotlin.
+To generate a Kotlin version file, simply specify the
+type
as follows:
import net.thauvin.erik.semver.Version
+
+@Version(properties = "version.properties", type="kt")
+open class Main {
+// ...
The Kotlin +default template implements the same static fields and functions as +the Java template.
+Please look at the examples/kotlin +project for a build.gradle.kts +sample.
To install and run from Gradle, add the following to build.gradle.kts:
-var semverProcessor = "net.thauvin.erik:semver:1.2.0"
-
-dependencies {
- kapt(semverProcessor)
- compileOnly(semverProcessor)
-}
-
-kapt {
- arguments {
- arg("semver.project.dir", projectDir)
- }
-}
The directory containing the configuration files (version.properties
, version.mustache
) must be specified using the semver.project.dir
processor argument.
To install and run from Gradle, add +the following to build.gradle.kts:
+var semverProcessor = "net.thauvin.erik:semver:1.2.0"
+
+{
+ dependencies (semverProcessor)
+ kapt(semverProcessor)
+ compileOnly}
+
+{
+ kapt {
+ arguments ("semver.project.dir", projectDir)
+ arg}
+ }
The directory containing the configuration files
+(version.properties
, version.mustache
) must be
+specified using the semver.project.dir
processor
+argument.
Incrementing the version is best left to your favorite build system. For a solution using Gradle, please have a look at the Semver Version Plugin for Gradle.
-There are also full examples in both Java and Kotlin showing how to use both the plugin and annotation processor concurrently.
+Incrementing the version is best left to your favorite build system. +For a solution using Gradle, please have a look at the Semver Version +Plugin for Gradle.
+There are also full examples +in both Java +and Kotlin +showing how to use both the plugin and annotation processor +concurrently.