Git command in gradle not working

Hi,
I have such code and it works ok while I am executing gradle build in Intelij Idea and in console but in eclispe it does not produce any output.

Please, can someone explain me how to make horrible eclipse working in normal way??

ext{
    buildNumber = ("git rev-parse HEAD").execute().text.trim()
}

println buildNumber

If you hard-code the path to git i.e.e /usr/bin/git does it work then in Eclipse?

I will try later, but it is not a solution of my problem, because my project must be able to build on different computers with different git installation directories, different OSs and different git versions.

You could use jgit, grgit or gradle-git

Not it is not, but it will tell you whether Eclipse removes PATH from the running environment.

Also I would echo @Lance’s recommendation for using grgit instead.

Thank you for your answers and I am going to try grgit!
But why it have to change my PATH from the running environment why can not it work normally?

Because all IDEs are evil, even IntelliJ.

Many tools will do that to isolate the environment from the build process. Even though there can be some frustration in it, as you have discovered in it, there is a lot of good in it.

Accidental pollution from the environment can lead to builds failing on some systems an not others. It can also lead to builds that are not repeatable. Many plugins in Gradle will also isolate the environment to an absolute minimum when running external tools.