Gradle init isn't interactive

Viewed 576

I am using gradle through command line for the first time. I am running the latest version of Ubuntu. My professor's instructions indicate that upon typing "gradle init" I should be prompted to say what type of project it is as well as the language, etc. Mine simply skips all of that and says "build successful" afterwards, my professors' file ends up with the proper directory structure and mine only has the basic root folders. From the quick searches I've done, I see that there is a difference between interactive and non-interactive responses, but I can't find anything regarding how to make it interactive.

3 Answers

If it says something along the lines of:

> Task :init SKIPPED
The build file 'build.gradle' already exists. Skipping build initialization.

BUILD SUCCESSFUL in 5s

Then it means you already have a Gradle build structure present. In order to initialize a new one, the directory you run it in must be empty.

I had this problem, too. Seems to be a bug.

You can tell gradle non-interactively what type to create, for example:

gradle init --type java-library

Other build types

My issue was I installed gradle with sudo apt install gradle which installs a very old version. Instead you can install sdk and then run sdk install gradle

Related