Gradle – “deprecated” tutorials

When I start with a new technology, usually I am starting with the latest version. So is the case of Gradle, I started with version 5.6.3

I started with various tutorials and books. Almost all of them promotes the following hello world example:

and when you will type gradle helloWorld you’ll get

What is happen here …

The << is a shorthand operator for the leftShift() method. In other tutorials or books you will se the >> operator (which is short hand for rightShift() method.

The thing is the << and >> operators were marked as deprecated in Gradle 4.x and removed starting with Gradle 5. This information may be found in Gradle official documentation here:

<< for task definitions no longer works. In other words, you can not use the syntax task myTask << { …​ }.

You will need to use the doLast() method as follow:

Spread the love

Leave a Reply