Reputation: 241
I want to build a project with gradle. I have included build.gradle in my project. But eclipse is not recognizing it as gradle project and I can't build it. Can anybody give a solution for this.
Upvotes: 24
Views: 33762
Reputation: 6400
I just had this problem in Spring Tool Suite.
Here's what I did.
The imported project's build.gradle
then appeared in the drop-down options of the Gradle view.
Upvotes: 18
Reputation: 1727
In Eclipse Neon you:
Right-click on your project --> Configure --> Add Gradle Nature.
Your project will automatically refresh and you will see all the dependencies being downloaded by Gradle.
Upvotes: 8
Reputation: 9591
If you are using the Buildship Eclipse plugin for Gradle integration, you can try to add the following snippet into your build.gradle file:
eclipse {
project.natures 'org.eclipse.buildship.core.gradleprojectnature'
.....
}
Then run "gradle eclipse" to re-generate Eclipse project files and refresh your project in Eclipse.
Upvotes: 14
Reputation: 11
I had a similar problem, to get eclipse to recognize the Gradle project I added the Gradle nature and then I had to click on Gradle->Refresh All
then the Gradle icon appeared and all dependencies were resolved.
Clicking on Enable Dependency Management
before refreshing resulted in "This operation is not enabled" and all the Gradle menu options getting greyed out.
Upvotes: 1
Reputation: 691755
Eclipse doesn't have native support for Gradle. There's an eclipse plugin available from SpringSource in order to support Gradle in Eclipse, but the easiest way is to generate the eclipse project from gradle, following the documentation.
Upvotes: 1