Semantic Version Annotation Processor 1.0
<1 min read
I've just released an annotation processor that automatically generates a 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.
Using annotation elements:
import net.thauvin.erik.semver.Version;
@Version(major = 1, minor = 0, patch = 0, preRelease = "beta")
public class SemverExample {
// …
}
Or using a properties file:
import net.thauvin.erik.semver.Version;
@Version(properties = "version.properties")
public class SemverExample {
// …
}
# version.properties
version.major=1
version.minor=0
version.patch=0
version.prerelease=beta
Upon running the annotation processor, a source file is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable Mustache template.
import net.thauvin.erik.semver.Version;
@Version(template = "version.mustache")
public class SemverExample {
// …
}
The annotation processor also supports Kotlin.
Documentation and source are on GitHub.