Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Project Version from build.gradle via Shell Bash Script

I want to be able to grab the build.gradle version via a bash shell script that happens post build. How would I go about getting this?

For reference, in a Maven project, I achieve this task by using the following commmand: mvn help:evaluate -Dexpression=project.version | grep -e '^[^\[]'. What is it's equivalent for Gradle?

like image 734
Patrick Conway Avatar asked Dec 14 '22 22:12

Patrick Conway


1 Answers

The properties task can also do this.

./gradlew properties | grep ^version:
like image 186
Paul Hicks Avatar answered Dec 28 '22 08:12

Paul Hicks