Saturday, April 26, 2014

Netbeans could not install Gradle distribution (Fixed)

Hello, I hope this helps.

I am using Ubuntu 13.04 and Netbeans 7.4 with Gradle 1.10.

After installing the Grade Support plugin for Netbeans I was not able to open or even create a simple Gradle project. I got this exception:

Stack trace: 
org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.11-bin.zip'. at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution.getToolingImplementationClasspath(DistributionFactory.java:133) at org.gradle.tooling.internal.consumer.loader.CachingToolingImplementationLoader.create(CachingToolingImplementationLoader.java:36) at org.gradle.tooling.internal.consumer.loader.SynchronizedToolingImplementationLoader.create(SynchronizedToolingImplementationLoader.java:40) at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.onStartAction(LazyConsumerActionExecutor.java:98) at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:81) at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:58) at org.gradle.tooling.internal.consumer.connection.LoggingInitializerConsumerActionExecutor.run(LoggingInitializerConsumerActionExecutor.java:44) at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:55) at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46) at org.gradle.tooling.internal.consumer.DefaultModelBuilder.get(DefaultModelBuilder.java:48) at org.netbeans.gradle.project.model.GradleModelLoader.loadModelWithProgress(GradleModelLoader.java:488) at org.netbeans.gradle.project.model.GradleModelLoader.access$600(GradleModelLoader.java:57) at org.netbeans.gradle.project.model.GradleModelLoader$6.run(GradleModelLoader.java:364) at org.netbeans.gradle.project.tasks.GradleDaemonManager.runNonBlockingGradleTask(GradleDaemonManager.java:24) at org.netbeans.gradle.project.tasks.GradleDaemonManager.access$100(GradleDaemonManager.java:14) at org.netbeans.gradle.project.tasks.GradleDaemonManager$2.run(GradleDaemonManager.java:105) at org.netbeans.gradle.project.tasks.GradleDaemonManager$3.run(GradleDaemonManager.java:130) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042) Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78) at org.gradle.wrapper.Install.createDist(Install.java:44) at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution.getToolingImplementationClasspath(DistributionFactory.java:129) at org.gradle.tooling.internal.consumer.loader.CachingToolingImplementationLoader.create(CachingToolingImplementationLoader.java:36) at org.gradle.tooling.internal.consumer.loader.SynchronizedToolingImplementationLoader.create(SynchronizedToolingImplementationLoader.java:40) at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.onStartAction(LazyConsumerActionExecutor.java:98) at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:81) at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:58) at org.gradle.tooling.internal.consumer.connection.LoggingInitializerConsumerActionExecutor.run(LoggingInitializerConsumerActionExecutor.java:44) at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:55) at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.(ZipFile.java:215) at java.util.zip.ZipFile.(ZipFile.java:145) at java.util.zip.ZipFile.(ZipFile.java:159) at org.gradle.wrapper.Install.unzip(Install.java:157) at org.gradle.wrapper.Install.access$400(Install.java:26) at org.gradle.wrapper.Install$1.call(Install.java:67) at org.gradle.wrapper.Install$1.call(Install.java:44) at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65) ... 13 more

After some googling (nice sport on a nice quite evening), I found that for some reason Netbeans or Gradle Wrapper is trying by default to use a version of Gradle that I do not have installed. In Ubuntu Gradle is installed in /usr/lib/gradle/x.x if you install it through apt-get.

I then opened Netbeans tools/options/Miscellaneous/Gradle tab and specified the Gradle Installation Directory to /usr/lib/gradle/1.10 in my case.



After this Netbeans project is loading properly, now I just need to fix some dependency issues, so I will keep googling for the rest of the evening.

Keep coding !
Posted by Marc Andreu Fernandez.

No comments: