Ok. Solved.
The build.gradle I posted is correct.
I had a problem of basic understanding of gradle (I thought launching a SpringApplication build from Eclipse would always launch gradle tasks too. Wrong!).
Another problem was that I got installed two versions of jdk on my system, and the old one conflicted with gradle
Could not target platform: ‘Java SE 11’ using tool chain: ‘JDK 10 (1.10)’.