I have Java projects in Eclipse Mars. I have Buildship 1.0.21 and Gradle 3.1. In Eclipse I right click a project and press Import > Gradle Project
and go through the wizard. When I'm done my project has its Gradle nature G
symbol but no build.gradle
, gradle wrapper folder or anything else gradle related (my other "real" projects have gradlew
and gradle.bat
files too).
Why does this happen and how to I fix this?
Welll, actually you don't have to have a
build.gradle
file or the Gradle wrapper to have a valid Gradle project. I guess eclipse is just recording in its metadata that this is a Gradle project but does not add any build files for you. But this is just a guess, as I use IntelliJ IDEA and not Eclipse for very good reasons.Try going on the commandline to your project and execute
/path/to/gradle init
and Gradle will add the wrapper files and a basicsettings.gradle
andbuild.gradle
. You can even give the init task a parameter to tell which kind of project this is, depending on this the create files may differ slightly. Or you can only do/path/to/gradle wrapper
to just add the Gradle wrapper but not auto-create build files. Afair you can even tell the wrapper or init task which Gradle version the wrapper should use, in case it should be a different version from the gradle you are calling to create the wrapper files.