gradle-grunt-plugin
gradle-grunt-plugin copied to clipboard
Set gradle project version from package.json
In my projects that use this plugin, I generally want Gradle project to have the same version as what is specified in the package.json
file. Do you think this would be a good thing to make part of the plugin?
Here is what I currently put in the build.gradle of my Gradle/Grunt projects:
import groovy.json.JsonSlurper
def packageSlurper = new JsonSlurper()
def packageJson = packageSlurper.parse file('package.json')
version = packageJson.version
I am open to a number of ways of implementing this. It could be an option set in the build.gradle
(usePackageJsonVersion=true
?), or you could just make the packageJson
object an extension property of the project, so you could just do the version=packageJson.version
bit and have access to the package.json
data for other things in the build.
I feel like this probably belongs in the gradle-grunt-plugin, but I could see arguments for making it part of the gradle-node-plugin too.
Nice, just copied and pasted this to our project as well.
Is this Impented yet?
I would also like to see this implemented if possible, any eta?