Open tschaffter opened 2 years ago
Why not put the build.gradle
under apps
and meanwhile, add settings.gradle
under apps
to declare all your sub-modules?
@tschaffter You can try the following:
$ cd challenge-registry
$ rm gradlew gradlew.bat
or
$ cd challenge-registry
$ cp -a libs/shared-java/challenge-util/gradle .
Why not put the build.gradle under apps and meanwhile, add settings.gradle under apps to declare all your sub-modules?
I'm relatively new to Gradle so not sure how this would work. Related to that I saw that there is a property buildFile
that can be specified in settings.json
to specify the location of build.gradle
. However, specifying the location of a build file seems deprecated.
@snjeza I'm not sure how these two suggestions could help. Also, the presence of either gradlew
or gradlew.bat
in the workspace root folder was a condition for the activation of the VS Code extension Spotless Gradle
that I used until recently.
I found a satisfying workaround that eliminates my need of having build.gradle
in the workspace folder (see https://github.com/Sage-Bionetworks/challenge-registry/pull/724). However, the issue remain that this language support extension may break for developers who work on projects that include a build.gradle
in the workspace folder.
@snjeza I'm not sure how these two suggestions could help. Also, the presence of either gradlew or gradlew.bat in the workspace root folder was a condition for the activation of the VS Code extension Spotless Gradle that I used until recently.
You have installed a gradle wrapper partially and Java LS crashes. You have the valid gradle wrapper in the libs/shared-java/challenge-util project. You should just copy it.
Thanks @snjeza. I indeed forgot to commit the folder gradle
in the commit I referenced earlier. However, I usually included this folder in my setup. To clarify, Java LS breaks with the following files in my workspace folder:
$ git status -u
On branch test-gradle-setup
Untracked files:
(use "git add <file>..." to include in what will be committed)
build.gradle
gradle/wrapper/gradle-wrapper.jar
gradle/wrapper/gradle-wrapper.properties
gradlew
gradlew.bat
nothing added to commit but untracked files present (use "git add" to track)
@tschaffter You can skip the gradle importer using
"java.import.gradle.enabled": false,
I'm relatively new to Gradle so not sure how this would work. Related to that I saw that there is a property buildFile that can be specified in settings.json to specify the location of build.gradle. However, specifying the location of a build file seems deprecated.
settings.json is used to persist VS Code's settings. AFAIK, we haven't expose any setting to specify the build.gradle location.
Is there some workaround for this issue? My build.gradle is on root and src folder is on root too, this is a single "module" project and i prefer this way. With this configuration it's impossible to use intellisense in java files.
My team is developing in an Nx monorepo with VS Code where apps and libraries are listed in the folder
apps/
andlibs
. Some of our apps and libs are in Java. We installed theExtension Pack for Java
, which include this extension (Language Support for Java(TM) by Red Hat
). Java projects are built with either Maven or Gradle. In this context, this VS Code extension works great as language support for Java. For example, IntelliSense works properly in VS Code for Java files.I observed that this extension breaks when placing the file
build.gradle
in the workspace root folder. By breaking, I mean that IntelliSense is no longer working. See this issue for more detailed information and logs. The issue is related to the presence of the filebuild.gradle
as an empty file still breaks the language support. Having a workspace-levelbuild.gradle
is a standard for multi-project build.The expected behavior is that this VS Code extension should work fine in the context of multi-project build with Gradle.
Environment
Steps To Reproduce
.java
file > IntelliSense does not workbuild.gradle
.java
file > IntelliSense worksDetailed logs can be found here.
Current Result
IntelliSense does not work in Java files. For example, no tooltip is displayed in VS Code when hovering on an
import
statement.Expected Result
IntelliSense should work in Java files.
Additional Informations