0

I have checked out a gradle project in eclipse but it is not able to recognise any annotation.Foe every annotation in each file it says

Configuration cannot be resolved to a 
 type

where configuration is annotation.

and all imports corresponding to annotation are also failing with following error:

The import org.springframework cannot be resolved

Entire project with all files is filled with error. But there is no such problem like this in Intellij for same project. Which setting am I missing for Eclipse ?

gradle build works fine although

user124
  • 423
  • 2
  • 7
  • 26
  • you are missing those libraries in your path – Stultuske Mar 25 '21 at 14:17
  • Your Eclipse instance is probably not able to understand Gradle projects out of the box. You might need to install a Gradle plugin (if not already present) and import the project as a Gradle project to tell Eclipse to actually read and use the gradle configuration like dependencies. – Thomas Mar 25 '21 at 14:19
  • Gradle nature is there already . – user124 Mar 25 '21 at 14:20
  • gradle build works fine for me,so it is not gradle problem.I have added gradle nature to eclipse – user124 Mar 25 '21 at 14:26
  • https://stackoverflow.com/questions/38171471/eclipse-not-recognizing-gradle-dependencies/38171826 has resolved it. – user124 Mar 26 '21 at 06:19

1 Answers1

0

From my experience, I did not see a checkout option in Eclipse for a Gradle project. I'm using Eclipse version 2019-06 (4.12.0). You need to check out the project in to your local file system and then do an import of the existing project as a Gradle Project.

Things to Note:

  1. Make sure you have the Gradle buildship plugin installed in your Eclipse. (The plugin I use. Buildship: Eclipse Plug-ins for Gradle, provided as part of the Gradle Platform.)
  2. Go to File --> Import. When a pop up box opens, scroll down to Gradle and select Existing Gradle project.

enter image description here

This Way Eclipse recognises the Gradle Project.

Raj Thugu
  • 37
  • 6
  • i opend a project from file system. And then right click on project => add gradle nature. – user124 Mar 25 '21 at 14:32
  • in my build path ,in the libraries section,i cannot see "Project and external Dependencies",i think it may be the problem. Do u know how to add it? – user124 Mar 25 '21 at 14:36
  • Is your project a Gradle Project? Gradle Projects should be imported differently on eclipse. I have updated my answer. Please let me know if that helps. – Raj Thugu Mar 25 '21 at 14:52
  • yes its a gradle project. I generally git clone repo to my local and then import into eclipse and then right click and select "Add gradle nature", Its same as what you are doing.I have been doing it for long .It works fine.I have checkout out one version and working on it for 2 weeks ,now because of some problem, i need to checkout the original version again.but when i import it.i see all annotation errors.although the version in which i have my changes works fine – user124 Mar 25 '21 at 14:59