I want to export project version to environment
by tag=
'gradle printVersion'`
printVersion
is gradle task
task exportVersion {
println project.version
}
it print 0.0.1-SNAPSHOT
to console, and my $tag env is set to 0.0.1-SNAPSHOT:exportVersionUP-TO-DATEBUILD SUCCESSFUL
How do I make the gradle to include :exportVersion, BUILD SUCCESSFUL to console?
First of all you have your task misconfigured. This way version will be printed every time gradle is run. To avoid it you should add an action: <<
or doLast
. To suppress gradle output, use -q
switch:
>cat build.gradle
task exportVersion << {
println project.version
}
>gradle -q exportVersion
unspecified
P.S. @DaveyDaveDave is right, it shouldn't be handled that way.