Fixing compile errors in eclipse We were seeing compile errors in eclipse due to: 1) Missing gradle output dirs in the extensions module. I removed those dirs from the eclipse classpath
2) Access restrictions on things like Unsafe. This was caused by a change in gradle 2.12 to add the java 1.8 execution environment, rather than the direct JDK dependency, to the project. That turned on access restrictions in eclipse for the execution environment. Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/c4b9756d Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/c4b9756d Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/c4b9756d Branch: refs/heads/feature/GEODE-835 Commit: c4b9756da6a549cd646fa797200382debf7a102c Parents: 7908467 Author: Dan Smith <upthewatersp...@apache.org> Authored: Thu May 12 17:10:29 2016 -0700 Committer: Dan Smith <upthewatersp...@apache.org> Committed: Fri May 13 11:37:02 2016 -0700 ---------------------------------------------------------------------- extensions/geode-modules-tomcat7/build.gradle | 6 ++++++ gradle/ide.gradle | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c4b9756d/extensions/geode-modules-tomcat7/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-tomcat7/build.gradle b/extensions/geode-modules-tomcat7/build.gradle index 975c976..3c75e56 100644 --- a/extensions/geode-modules-tomcat7/build.gradle +++ b/extensions/geode-modules-tomcat7/build.gradle @@ -49,4 +49,10 @@ dependencies { testCompile project(path: ':geode-junit') testCompile files(project(':geode-core').sourceSets.test.output) testCompile files(project(':extensions/geode-modules').sourceSets.test.output) + + eclipse.classpath.file { + whenMerged { classpath -> + classpath.entries.removeAll { entry -> entry.path.contains('geode-modules/build')} + } + } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c4b9756d/gradle/ide.gradle ---------------------------------------------------------------------- diff --git a/gradle/ide.gradle b/gradle/ide.gradle index adaf8d9..03f6565 100644 --- a/gradle/ide.gradle +++ b/gradle/ide.gradle @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import org.gradle.plugins.ide.eclipse.model.Container allprojects { apply plugin: 'idea' apply plugin: 'eclipse' @@ -26,11 +27,19 @@ subprojects { downloadSources = true plusConfigurations += [ configurations.provided ] file { - // Remove the gradle output directories from the eclipse classpath. - // Unfortunately, using minusConfigurations does not work here, because - // it removes the entire geode-core project. whenMerged { classpath -> + // Remove the gradle output directories from the eclipse classpath. + // Unfortunately, using minusConfigurations does not work here, because + // it removes the entire geode-core project. classpath.entries.removeAll { entry -> entry.path.contains('geode-core/build')} + + //By default, gradle adds the java 1.8 *execution environment*, which has access restrictions on + //things like Unsafe. Change it to a direct dependency on the workspace JDK + classpath.entries = classpath.entries.collect { entry -> + entry.path.contains('org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE') + ? new Container('org.eclipse.jdt.launching.JRE_CONTAINER') + : entry + } } } }