我在Windows上使用最新版本的Gradle运行netbeans,每当我尝试从Gradle任务面板中选择旧项目时,我都会收到以下错误:
Requested project: D:\ian\libGDX\MarioBros
Stack trace:
org.gradle.tooling.GradleConnectionException: Could not fetch model of type 'BuildEnvironment' using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.10-all.zip'.
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:55)
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:29)
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:41)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
at org.gradle.tooling.internal.consumer.DefaultModelBuilder.get(DefaultModelBuilder.java:50)
at org.netbeans.gradle.project.model.DefaultGradleModelLoader.loadModelWithProgress(DefaultGradleModelLoader.java:551)
at org.netbeans.gradle.project.model.DefaultGradleModelLoader.access$1600(DefaultGradleModelLoader.java:64)
at org.netbeans.gradle.project.model.DefaultGradleModelLoader$6.run(DefaultGradleModelLoader.java:419)
at org.netbeans.gradle.project.tasks.GradleDaemonManager.runNonBlockingGradleTask(GradleDaemonManager.java:35)
at org.netbeans.gradle.project.tasks.GradleDaemonManager.access$100(GradleDaemonManager.java:22)
at org.netbeans.gradle.project.tasks.GradleDaemonManager$2.execute(GradleDaemonManager.java:125)
at org.jtrim.concurrent.AbstractTaskExecutorService$FunctionWrapper.execute(AbstractTaskExecutorService.java:270)
at org.jtrim.concurrent.AbstractTaskExecutorService$TaskOfAbstractExecutor.execute(AbstractTaskExecutorService.java:340)
at org.jtrim.concurrent.Tasks$RunOnceCancelableTask.execute(Tasks.java:342)
at org.jtrim.concurrent.SingleThreadedExecutor$QueuedItem.runTask(SingleThreadedExecutor.java:919)
at org.jtrim.concurrent.SingleThreadedExecutor$QueuedItem.access$1200(SingleThreadedExecutor.java:898)
at org.jtrim.concurrent.SingleThreadedExecutor$Impl$Worker.executeTask(SingleThreadedExecutor.java:815)
at org.jtrim.concurrent.SingleThreadedExecutor$Impl$Worker.processQueue(SingleThreadedExecutor.java:827)
at org.jtrim.concurrent.SingleThreadedExecutor$Impl$Worker.run(SingleThreadedExecutor.java:861)
at org.jtrim.concurrent.SingleThreadedExecutor$Impl$1.run(SingleThreadedExecutor.java:453)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.gradle.api.GradleException: Java home supplied via 'org.gradle.java.home' is invalid. Invalid directory: C:\Program Files\Java\jdk1.8.0_92
at org.gradle.launcher.cli.converter.PropertiesToDaemonParametersConverter.convert(PropertiesToDaemonParametersConverter.java:51)
at org.gradle.tooling.internal.provider.ProviderConnection.initParams(ProviderConnection.java:172)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:91)
at org.gradle.tooling.internal.provider.DefaultConnection.getModel(DefaultConnection.java:168)
at org.gradle.tooling.internal.consumer.connection.CancellableModelBuilderBackedModelProducer.produceModel(CancellableModelBuilderBackedModelProducer.java:53)
at org.gradle.tooling.internal.consumer.connection.PluginClasspathInjectionSupportedCheckModelProducer.produceModel(PluginClasspathInjectionSupportedCheckModelProducer.java:41)
at org.gradle.tooling.internal.consumer.connection.AbstractConsumerConnection.run(AbstractConsumerConnection.java:58)
at org.gradle.tooling.internal.consumer.connection.ParameterValidatingConsumerConnection.run(ParameterValidatingConsumerConnection.java:46)
at org.gradle.tooling.internal.consumer.DefaultModelBuilder$1.run(DefaultModelBuilder.java:60)
at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:84)
at org.gradle.tooling.internal.consumer.connection.CancellableConsumerActionExecutor.run(CancellableConsumerActionExecutor.java:45)
at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:58)
at org.gradle.tooling.internal.consumer.connection.RethrowingErrorsConsumerActionExecutor.run(RethrowingErrorsConsumerActionExecutor.java:38)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:55)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
... 1 more
其他人是否遇到过此错误?如何解决这个问题?
4条答案
按热度按时间mdfafbf11#
其实这个问题已经在这里描述过了
如果转到gradle.properties配置文件,您将获得以下内容
org.gradle.java.home=C:\Program Files\Java\jdk1.8.0_92
您可以删除它或给予原始的JAVA_HOME位置。希望它能解决你的问题。
**B:**如果你的路径是OK的,那么在你的路径中使用双反斜杠“\”,就像上面一样。
mo49yndu2#
%userprofile%\.gradle\gradle.properties
中错误的jdk版本导致了我的问题。另一个尝试的选项是直接在gradle_dir/bin/gradle.bat中硬编码java home路径,如下所示:zrfyljdw3#
这可能是
proxy
问题,请尝试创建包含以下内容的%userprofile%\.gradle\gradle.properties
或~/.gradle/gradle.properties
:5us2dqdw4#
这个解决方案对我有效。安装gradle版本,distributionURL保持不变,就像你的问题2.10打开Eclipse > New > Project > Gradle > Gradle Project >..>覆盖工作区设置>本地安装目录>浏览>选择gradle安装文件夹,如(/opt/gradle/gradle-2.10)>下一步> gradle属性将链接到buildship >完成>将创建新项目。
在下次尝试导入时,请确保覆盖工作区设置>本地安装目录>浏览>选择gradle安装文件夹,如(/opt/gradle/gradle-2.10)项目将被导入,没有任何问题。