Hi,
I am a recent convert from edu.sc.seis.version-class to your simple, yet nicely configurable, versioning plugin. I think for new users, an example of using variables might get them closer to the right solution for their needs. In my case, I created a simple gradle file to apply elsewhere with some sensible, imho, defaults:
- the gversion
srcDir is in the build folder, specifically: "build/generated-src/version/java"
- the sourceSet for main is updated to add this directory
- the
classPackage is programmatically defined as: project.group + "." + project.name.replace('-','.')
- A
compileJava task dependsOn for createVersionFile is added.
apply plugin: "com.peterabeles.gversion"
// configure build version output
gversion {
srcDir = "build/generated-src/version/java"
classPackage = project.group + "." + project.name.replace('-','.')
className = "BuildVersion"
}
// Add generated-src/version folder to main source set
sourceSets {
main {
java {
srcDir layout.buildDirectory.get().getAsFile().toString() + "/generated-src/version/java"
}
}
}
// add dependency to ensure correct ordering
tasks.named('compileJava') {
dependsOn(createVersionFile)
}
If you think this would be useful, happy to write it up as a markdown and submit a PR. Otherwise, feel free to ignore. I appreciate the nice plugin.
Thanks Again!
Hi,
I am a recent convert from
edu.sc.seis.version-classto your simple, yet nicely configurable, versioning plugin. I think for new users, an example of using variables might get them closer to the right solution for their needs. In my case, I created a simple gradle file to apply elsewhere with some sensible, imho, defaults:srcDiris in the build folder, specifically: "build/generated-src/version/java"classPackageis programmatically defined as: project.group + "." + project.name.replace('-','.')compileJavatask dependsOn forcreateVersionFileis added.If you think this would be useful, happy to write it up as a markdown and submit a PR. Otherwise, feel free to ignore. I appreciate the nice plugin.
Thanks Again!