diff --git a/.circleci/config.yml b/.circleci/config.yml
index 65723f0..4690865 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,41 +1,44 @@
-inversion: 2
+version: 2
defaults: &defaults
working_directory: ~/repo
+ docker:
+ - image: circleci/openjdk:8-jdk
environment:
JVM_OPTS: -Xmx3200m
TERM: dumb
- CI_NAME: "CircleCI"
-
-defaults_gradle: &defaults_bld
- steps:
- - checkout
- - run:
- name: Download the dependencies
- command: ./bld download
- - run:
- name: Run tests with bld
- command: ./bld compile test
jobs:
- bld_jdk20:
+ build_gradle:
<<: *defaults
- docker:
- - image: cimg/openjdk:20.0
+ steps:
+ - checkout
+ - restore_cache:
+ keys:
+ - gradle-dependencies-{{ checksum "build.gradle" }}
+ # fallback to using the latest cache if no exact match is found
+ - gradle-dependencies-
- <<: *defaults_bld
+ - run:
+ name: Gradle Dependencies
+ command: ./gradlew dependencies
- bld_jdk17:
- <<: *defaults
+ - save_cache:
+ paths: ~/.m2
+ key: gradle-dependencies-{{ checksum "build.gradle" }}
- docker:
- - image: cimg/openjdk:17.0
+ - run:
+ name: Run All Checks
+ command: ./gradlew check
- <<: *defaults_bld
+ - store_artifacts:
+ path: build/reports/
+ destination: reports
+ - store_test_results:
+ path: build/reports/
workflows:
version: 2
- bld:
+ build_gradle_jdk8:
jobs:
- - bld_jdk17
- - bld_jdk20
+ - build_gradle
diff --git a/.editorconfig b/.editorconfig
index 1f808de..a6971e1 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,2 +1,2 @@
[*]
-insert_final_newline = true
+insert_final_newline=true
diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml
deleted file mode 100644
index 79093d1..0000000
--- a/.github/workflows/bld.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-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/.gitignore b/.gitignore
index 091e664..f007981 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,57 +1,84 @@
-.gradle
+.vscode/*
+!.vscode/extensions.json
+!.vscode/launch.json
+!.vscode/settings.json
+!.vscode/tasks.json
+
+__pycache__
+.classpath
.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
+.gradle
+.history
+.kobalt
+.mtj.tmp/
+.mvn/timing.properties
+.mvn/wrapper/maven-wrapper.jar
+.nb-gradle
+.project
+.scannerwork
+.settings
+*.class
+*.code-workspace
+*.ctxt
+*.iws
+*.log
+*.nar
+*.rar
+*.sublime-*
+*.tar.gz
+*.zip
+/**/.idea_modules/
+/**/.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/$CACHE_FILE$
+/**/.idea/$PRODUCT_WORKSPACE_FILE$
atlassian-ide-plugin.xml
-
-# Cursive Clojure plugin
-.idea/replstate.xml
-
-# SonarLint plugin
-.idea/sonarlint/
-
-# Editor-based Rest Client
-.idea/httpRequests
-
-local.properties
\ No newline at end of file
+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/
+gradle.properties
+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
+Thumbs.db
+venv
diff --git a/.idea/app.iml b/.idea/app.iml
deleted file mode 100644
index 787b59b..0000000
--- a/.idea/app.iml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
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
deleted file mode 100644
index 0a58f86..0000000
--- a/bin/main/semver-kt.mustache
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-* 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
deleted file mode 100644
index cd7c567..0000000
--- a/bin/main/semver.mustache
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-* 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
deleted file mode 100644
index c8c9fde..0000000
Binary files a/bin/test/net/thauvin/erik/semver/ConstantsTest.class and /dev/null differ
diff --git a/bin/test/net/thauvin/erik/semver/VersionInfoTest.class b/bin/test/net/thauvin/erik/semver/VersionInfoTest.class
deleted file mode 100644
index 8c5f8b4..0000000
Binary files a/bin/test/net/thauvin/erik/semver/VersionInfoTest.class and /dev/null differ
diff --git a/bin/test/net/thauvin/erik/semver/VersionProcessorTest.class b/bin/test/net/thauvin/erik/semver/VersionProcessorTest.class
deleted file mode 100644
index 5166fb7..0000000
Binary files a/bin/test/net/thauvin/erik/semver/VersionProcessorTest.class and /dev/null differ
diff --git a/bin/test/net/thauvin/erik/semver/VersionTest.class b/bin/test/net/thauvin/erik/semver/VersionTest.class
deleted file mode 100644
index 0047ff2..0000000
Binary files a/bin/test/net/thauvin/erik/semver/VersionTest.class and /dev/null differ
diff --git a/bld b/bld
deleted file mode 100755
index 824b742..0000000
--- a/bld
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/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
deleted file mode 100644
index ab43bcd..0000000
--- a/bld.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@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
new file mode 100644
index 0000000..0910c36
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,239 @@
+plugins {
+ id 'checkstyle'
+ id 'java'
+ id 'jacoco'
+ id 'maven-publish'
+ id 'pmd'
+ id 'com.jfrog.bintray' version '1.8.5'
+ id 'com.github.ben-manes.versions' version '0.28.0'
+ id 'net.thauvin.erik.gradle.semver' version '1.0.4'
+ id 'com.github.spotbugs' version '4.4.4'
+ id 'org.sonarqube' version '3.0'
+}
+
+import com.github.spotbugs.snom.SpotBugsTask
+import org.apache.tools.ant.taskdefs.condition.Os
+
+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'
+
+final def pkgLicenses = ['BSD 3-Clause']
+final def pkgIssueTrackerUrl = mavenUrl + '/issues'
+final def pkgLabels = ['java', 'kotlin', 'annotation', 'processor', 'semantic', 'version']
+
+ext.versions = [
+ spotbugs: '4.0.6'
+]
+
+repositories {
+ mavenLocal()
+ jcenter()
+ mavenCentral()
+}
+
+dependencies {
+ implementation 'com.github.spullara.mustache.java:compiler:0.9.6'
+
+ spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.10.1'
+ spotbugsPlugins 'com.mebigfatguy.sb-contrib:sb-contrib:7.4.7'
+
+ compileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs"
+ testCompileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs"
+
+ testImplementation 'org.testng:testng:7.2.0'
+}
+
+
+tasks.withType(JavaCompile) {
+ options.encoding = 'UTF-8'
+}
+
+java {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
+
+pmd {
+ ignoreFailures = true
+ ruleSets = []
+ ruleSetFiles = files("${projectDir}/config/pmd.xml")
+ consoleOutput = true
+}
+
+bintray {
+ user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
+ key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
+ publications = ['MyPublication']
+ dryRun = false
+ pkg {
+ repo = 'maven'
+ name = mavenName
+ licenses = pkgLicenses
+ desc = mavenDescription
+ //released = new Date()
+ websiteUrl = mavenUrl
+ issueTrackerUrl = pkgIssueTrackerUrl
+ vcsUrl = mavenScmCon
+ labels = pkgLabels
+ publicDownloadNumbers = true
+ version {
+ gpg { sign = true }
+ }
+ }
+}
+
+bintrayUpload {
+ versionName = "$project.version"
+ versionDesc = "$mavenName $project.version"
+ versionVcsTag = "$project.version"
+ versionReleased = new Date()
+}
+
+task javadocJar(type: Jar, dependsOn: javadoc) {
+ group = 'Build'
+ description = 'Builds an archive of the javadoc docs.'
+ archiveClassifier.set('javadoc')
+ from javadoc.destinationDir
+}
+
+task sourceJar(type: Jar) {
+ group = 'Build'
+ description = 'Builds an archive of the source code.'
+ archiveClassifier.set('sources')
+ from sourceSets.main.allSource
+}
+
+artifacts {
+ archives javadocJar
+ archives sourceJar
+}
+
+publishing {
+ publications {
+ MyPublication(MavenPublication) {
+ from components.java
+ artifact sourceJar
+ artifact javadocJar
+ groupId project.group
+ artifactId rootProject.name
+
+ pom {
+ name = mavenName
+ description = mavenDescription
+ url = mavenUrl
+ licenses {
+ license {
+ name = mavenLicense
+ url = mavenLicenseUrl
+ distribution = 'repo'
+ }
+ }
+ developers {
+ developer {
+ id = 'ethauvin'
+ name = 'Erik C. Thauvin'
+ email = 'erik@thauvin.net'
+ }
+ }
+ scm {
+ connection = "scm:git:" + mavenScmCon
+ developerConnection = "scm:git:" + mavenScmDevCon
+ url = mavenScmCon
+ }
+ }
+ }
+ }
+}
+
+javadoc {
+ doFirst {
+ title = "$mavenDescription $project.version API"
+ }
+ options.with {
+ tags = ['created']
+ author = true
+ //addBooleanOption('html4', true)
+ links('https://docs.oracle.com/javase/8/docs/api/')
+ //addStringOption('Xdoclint:none', '-quiet')
+ }
+}
+
+test {
+ useTestNG()
+}
+
+spotbugs {
+ toolVersion = versions.spotbugs
+ excludeFilter = file("$projectDir/config/spotbugs/excludeFilter.xml")
+}
+
+tasks.withType(SpotBugsTask) {
+ reports {
+ xml.enabled = false
+ html.enabled = true
+ }
+}
+
+tasks.withType(Checkstyle) {
+ reports {
+ xml.enabled = false
+ html.enabled = true
+ }
+}
+
+task release(dependsOn: ['wrapper', 'clean', 'publishToMavenLocal']) {
+ group = 'Publishing'
+ description = 'Releases new version to local maven repository.'
+ doFirst {
+ println("Version: $version")
+ }
+}
+
+task pandoc(type: 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 {
+ reports {
+ html.enabled = true
+ xml.enabled = true
+ }
+
+}
+
+sonarqube {
+ properties {
+ property("sonar.projectKey", "ethauvin_semver")
+ property("sonar.sourceEncoding", "UTF-8")
+ }
+}
+
+tasks.sonarqube {
+ dependsOn("jacocoTestReport")
+}
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
new file mode 100644
index 0000000..c5f6465
--- /dev/null
+++ b/config/checkstyle/checkstyle.xml
@@ -0,0 +1,277 @@
+
+
+
+
+
+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 {
-// ...
# version.properties
-version.major=1
-version.minor=0
-version.patch=0
-version.prerelease=beta
import net.thauvin.erik.semver.Version;
+
+@Version(properties = "version.properties")
+public class A {
+// ...
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 |
@@ -273,19 +207,17 @@ href="https://docs.oracle.com/javase/8/docs/api/java/util/Date.html">
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(
-= "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=
-# ...
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=
+# ...
-⚠️ -
+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.⚠️
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.
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 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 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.
+To install and run from Gradle, add the following to build.gradle:
+dependencies {
+ annotationProcessor 'net.thauvin.erik:semver:1.2.0'
+ implementation '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.
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
.
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
.
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 (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.
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)
+ implementation(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 Kobalt, add the following to Build.kt:
+dependencies {
+ apt("net.thauvin.erik:semver:1.2.0")
+ compileOnly("net.thauvin.erik:semver:1.2.0")
+}
+
+Please look at Build.kt in the examples/java directory for a sample.
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.