netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Error loading Gradle project in Netbeans 14 - Could not run build action using connection to Gradle installation

Open hamishg opened this issue 3 years ago • 5 comments

Apache NetBeans version

Apache NetBeans 14

What happened

Tried to load a Gradle project using Gradle v5.2.1 in Netbeans 14 and got this error:

Could not run build action using connection to Gradle installation '/Users/{myuser}/.gradle/wrapper/dists/gradle-5.2.1-bin/9lc4nzslqh3ep7ml2tp68fk8s/gradle-5.2.1'

This project loads correctly in Netbeans 13.

How to reproduce

  • Fresh Netbeans 14 install. Settings not imported from older version.
  • Open the attached sample Hello World project with Gradle wrapper v5.2.1 .
  • Try and build the project
  • (hopefully see the error)

gradleloading.zip

Did this work correctly in an earlier version?

Apache NetBeans 13

Operating System

macOS 11.6 Big Sur running on aarch64 (M1 Mac)

JDK

OpenJDK Runtime Environment 11.0.13+8-LTS

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

Things I have tried:

  • Deleting Netbeans cache in ~/Library/Caches/NetBeans/14
  • Deleting Netbeans data in ~/Library/Application Support/NetBeans/14
  • Deleting Gradle wrappers in ~/.gradle

When the Gradle wrapper is not present then Netbeans is downloading it ok but still has the same problem loading the project.

Are you willing to submit a pull request?

No

Code of Conduct

Yes

hamishg avatar Jun 17 '22 16:06 hamishg

Well the sample project works correctly with NetBeans 15

lkishalmi avatar Aug 07 '22 19:08 lkishalmi

I tried with a fresh install of Netbeans 15. I now get a different error message when trying to build the sample project provided earlier:

org.codehaus.groovy.runtime.metaclass.MissingPropertyExceptionNoStack: No such property: classesDirectory for class: org.gradle.api.internal.file.DefaultSourceDirectorySet

hamishg avatar Sep 07 '22 15:09 hamishg

Concur with @lkishalmi - working fine on NetBeans 15 (on Linux at least). Are you using an aarch64 or amd64 JDK on your M1? Will try and replicate on my M1 machine at some point.

neilcsmith-net avatar Sep 07 '22 15:09 neilcsmith-net

Thank you. I appreciate you taking time to look at this. Yes I'm using an arm build of openjdk11 from Azul.

I've managed to build/run the project by toggling "Prefer to use gradle wrapper that comes with the project" off. Then building the project and turning it back on again. The project is now building/running with the gradle wrapper option on again.

Projects using new Gradle versions (v6.9) all seem to work fine. I only had the issue trying to build/run a project using Gradle 5.2.1.

hamishg avatar Sep 07 '22 16:09 hamishg

I can confirm I'm seeing the same issue as @hamishg on Netbeans 15...

I tried with a fresh install of Netbeans 15. I now get a different error message when trying to build the sample project provided earlier:

org.codehaus.groovy.runtime.metaclass.MissingPropertyExceptionNoStack: No such property: classesDirectory for class: org.gradle.api.internal.file.DefaultSourceDirectorySet

The workaround provided by @hamishg also worked for me.

The affected Gradle project is using the Gradle Wrapper and is on version 5.6, and the Java version I'm using on an M1 Mac (aarch64) is:

openjdk version "11.0.16" 2022-07-19
OpenJDK Runtime Environment Temurin-11.0.16+8 (build 11.0.16+8)
OpenJDK 64-Bit Server VM Temurin-11.0.16+8 (build 11.0.16+8, mixed mode)

alewis001 avatar Sep 27 '22 09:09 alewis001

More than one year old, seems to have a workaround. Closing.

lkishalmi avatar Oct 20 '23 05:10 lkishalmi