I have the following project structure:
So happens that I have to recreate Eclipse projects often. I run command:
gradle cleanEclipse eclipse
After a number of runs "eclipse" task stops working as expected. Namely, it does not add gradle nature to the projects anymore and does not recognize
sourceCompatibility = 1.6
anymore attempting to build everything with 1.8 version of Java.
I added the following to the root build.gradle:
allprojects {
sourceCompatibility = 1.6
eclipse.project {
natures 'org.springsource.ide.eclipse.gradle.core.nature'
}
// more stuff here ...
}
This helped with the root project, but had no effect on any other project. I added the same thing to subprojects with the same unsatisfactory result. I have to say than even after the nature had been added to the root project and Gradle plugin options became available for the root again I still don't see the "G" icon.
So it looks like I have 2 problems with the gradle setup.
Disappearance of the gradle nature. After a few runs Eclipse stops recognizing gradle projects. I wouldn't even face the second problem if that worked properly.
Some problem with my gradle build files or projects layout as my settings don't seem to take effect on subprojects.
Missing "G" icon for the project with restored Gradle nature.
Any help would be greatly appreciated!
Using the Buildship: Eclipse Plug-ins for Gradle I had to use natures string 'org.eclipse.buildship.core.gradleprojectnature'
For Example:
allprojects {
eclipse.project {
natures 'org.eclipse.buildship.core.gradleprojectnature'
}
}