We are having a frustrating problem with our Eclipse workspace. Here is a high-level example of what is happening:
ProjectA
-- src/main/java/...
-- build.gradle
ProjectB
-- src/main/java/...
-- build.gradle
After running gradle eclipse
and importing the projects into Eclipse, we occasionally will get 'MyType cannot be resolved to a type' even though the following are true:
- Our projects have the Gradle library container on their classpath
- The projects have the correct workspace projects within their Gradle container
- Things like CTRL + Click work from types that are showing up with red underline (i.e. compile error) meaning Eclipse knows exactly how to get to those types, but the compiler can't find them
- Command-line Gradle builds work as expected
This is happening throughout the team and we cannot figure out why Eclipse keeps going out of sync and cannot compile from time to time. What usually fixes the problem is a combination of:
- Project > Clean in Eclipse
- Gradle cleanEclipse or gradle eclipse
- Reimporting the projects
- etc
Other notes:
- Using Gradle version 2.2.1
- Happens in both Eclipse Luna and Eclipse Mars
- Using JDK 8
Has anyone else had these types of compile issues in Eclipse with Gradle projects?