Q:

Eclipse Gradle plugin fails to retrieve Gradle distro on fresh Luna install

I'm really getting frustrated with the Gradle and Groovy plugins in Luna.  I first started with STS 3.6.4 and I got to a state where many of the bindings in my Groovy views simply didn't work, and I haven't gotten a single response to any of my postings about this.
I then decided to try a fresh Eclipse Luna install, and then install the Groovy and Gradle plugins over that.  When I finally imported my Groovy projects I saw weird errors along the lines of this:
org.gradle.jvm.tasks.Jar
Could not fetch model of type 'EclipseProject' using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.2.1-bin.zip'.

I know that Eclipse Mars will completely replace this Gradle tooling, I just hope I can survive until then.
The stacktrace in the log is this:
org.gradle.tooling.BuildException: Could not fetch model of type 'EclipseProject' using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.2.1-bin.zip'.

    at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:57)

    at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)

    at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

    at java.lang.Thread.run(Thread.java:745)

    at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)

    at org.gradle.tooling.internal.consumer.DefaultModelBuilder.get(DefaultModelBuilder.java:48)

    at org.springsource.ide.eclipse.gradle.core.modelmanager.ToolinApiUtils.buildModel(ToolinApiUtils.java:103)

    at org.springsource.ide.eclipse.gradle.core.modelmanager.DefaultModelBuilder.doBuild(DefaultModelBuilder.java:30)

    at org.springsource.ide.eclipse.gradle.core.modelmanager.AbstractModelBuilder.buildModel(AbstractModelBuilder.java:40)

    at org.springsource.ide.eclipse.gradle.core.modelmanager.HierarchicalProjectBuildStrategy.buildReferenceModel(HierarchicalProjectBuildStrategy.java:179)

    at org.springsource.ide.eclipse.gradle.core.modelmanager.HierarchicalProjectBuildStrategy.buildModels(HierarchicalProjectBuildStrategy.java:65)

    at org.springsource.ide.eclipse.gradle.core.modelmanager.GradleProjectModelManager.getModelInternal(GradleProjectModelManager.java:141)

    at org.springsource.ide.eclipse.gradle.core.modelmanager.GradleProjectModelManager.getModel(GradleProjectModelManager.java:100)

    at org.springsource.ide.eclipse.gradle.core.modelmanager.GradleModelManager.getModel(GradleModelManager.java:77)

    at org.springsource.ide.eclipse.gradle.core.GradleProject.getModel(GradleProject.java:576)

    at org.springsource.ide.eclipse.gradle.core.classpathcontainer.ClassPathModel.getClassPathModel(ClassPathModel.java:66)

    at org.springsource.ide.eclipse.gradle.core.classpathcontainer.GradleClassPathContainer$1.doit(GradleClassPathContainer.java:134)

    at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable$1.run(GradleRunnable.java:53)

    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Caused by: org.gradle.internal.exceptions.LocationAwareException: A problem occurred configuring root project 'YangUsingProject'.

    at org.gradle.initialization.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:77)

    at org.gradle.initialization.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:47)

    at org.gradle.initialization.StackTraceSanitizingExceptionAnalyser.transform(StackTraceSanitizingExceptionAnalyser.java:30)

    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:108)

    at org.gradle.initialization.DefaultGradleLauncher.getBuildAnalysis(DefaultGradleLauncher.java:97)

    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.configure(InProcessBuildActionExecuter.java:84)

    at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:45)

    at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:30)

    at org.gradle.tooling.internal.provider.ConfiguringBuildAction.run(ConfiguringBuildAction.java:119)

    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)

    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)

    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:47)

    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:119)

    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:35)

    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:119)

    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)

    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:119)

    at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)

    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:119)

    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71)

    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69)

    at org.gradle.util.Swapper.swap(Swapper.java:38)

    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69)

    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:119)

    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)

    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:119)

    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:70)

    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:119)

    at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:39)

    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:119)

    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:46)

    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)

    at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)

Caused by: org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'YangUsingProject'.

    at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:91)

    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:86)

    at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:65)

    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:504)

    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:83)

    at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)

    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)

    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)

    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)

    ... 32 more

Caused by: org.gradle.listener.ListenerNotificationException: Failed to notify project evaluation listener.

    at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:94)

    at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)

    at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)

    at com.sun.proxy.$Proxy12.afterEvaluate(Unknown Source)

    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:79)

    ... 39 more

Caused by: java.lang.NoClassDefFoundError: org/gradle/jvm/tasks/Jar

    at com.att.opnfv.yang.gradle.YangPlugin$_apply_closure1.doCall(YangPlugin.groovy:51)

    at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)

    at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)

    at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:83)

    ... 43 more

Caused by: java.lang.ClassNotFoundException: org.gradle.jvm.tasks.Jar

    ... 47 more

A:

It appears that I've managed to fix this, although I'm not sure exactly what's going on here.
I realized that perhaps this "org.gradle.jvm.tasks.Jar" class may not be in the version of Gradle it's trying to download (2.2.1), but something in the Gradle plugin or my build script expects this to be there.  I do reference that task in my custom Gradle plugin, so perhaps that's the reference that causes a problem.
I finally went into the Gradle preferences to see what version of Gradle it thought it was using, and it only said "Use Gradle Wrapper Default", whatever that is.  I tried changing that property to point to my Gradle 2.3 distribution, and now that error has gone away.

