vscode-gradle icon indicating copy to clipboard operation
vscode-gradle copied to clipboard

Classpath for Gradle API not recognized with developing Gradle plugins using Gradle init.

Open BenHunt-io opened this issue 3 years ago • 4 comments

Extension Name: vscode-gradle Extension Version: 3.12.2 OS Version: Mac OS Monterey 12.4 VSCode version: 1.69.2

Describe the bug VSCode acts like the Gradle API's are not on the classpath when using gradle init to develop gradle plugins. VSCode does not recogonize org.gradle.api.* classes.

To Reproduce

My sample project is here: https://github.com/BenHunt-io/gradle-classpath-vscode-issue

gradle-classpath-vscode-issue % gradle init

Select type of project to generate:
  1: basic
  2: application
  3: library
  4: Gradle plugin
Enter selection (default: basic) [1..4] 4

Select implementation language:
  1: Groovy
  2: Java
  3: Kotlin
Enter selection (default: Java) [1..3] 2

Select build script DSL:
  1: Groovy
  2: Kotlin
Enter selection (default: Groovy) [1..2] 1

Generate build using new APIs and behavior (some features may change in the next minor release)? (default: no) [yes, no]yesProject name (default: gradle-classpath-vscode-issue):
Source package (default: gradle.classpath.vscode.issue):

> Task :init
Get more help with your project: https://docs.gradle.org/7.4.2/userguide/custom_plugins.html

BUILD SUCCESSFUL in 25s
2 actionable tasks: 2 executed

Expected behavior

I expect VSCode to recognize org.gradle.api.* classes.

Screenshots Screen Shot 2022-07-22 at 10 10 17 AM Screen Shot 2022-07-22 at 10 11 34 AM Screen Shot 2022-07-22 at 10 13 53 AM

Output from "Gradle for Java" You can find this by clicking on the "Output" panel, then selecting the "Gradle for Java" channel from the dropdown.

Does the bug still exist if you disable all other extensions? Yes

Additional context Add any other context about the problem here.

BenHunt-io avatar Jul 22 '22 15:07 BenHunt-io

Seeing similar issues when upgrading to gradle 7.5. Reverting to gradle 7.4.2 fixed this issue for me

adam-thorpe avatar Aug 02 '22 09:08 adam-thorpe

@adam-thorpe

I also fixed it by upgrading to Gradle 7.5.1 using HomeBrew on MacOS

BenHunt-io avatar Sep 07 '22 21:09 BenHunt-io

It's a bug about redhat.java extension, since vscode-gradle does nothing about the classpath.

Besides, I'm curious about this bug. @BenHunt-io did you simply fix it by upgrading the wrapper (by modifying /gradle/wrapper/gradle-wrapper.properties) and not cleaning java language server workspace?

CsCherrYY avatar Sep 13 '22 02:09 CsCherrYY

I rebuilt the wrapper, using gradle wrapper, after upgrading grade on my local filesystem. I can't say or not whether I cleaned or didn't clean the workspace.. but I do know I cleaned the workspace on 7.4.2 and it didn't do anything.

BenHunt-io avatar Sep 13 '22 14:09 BenHunt-io