'Compile Groovy in VSCode
I've found the vscode-groovy
extension that does the formatting and highlighting, but I'm really having trouble getting the compiler/debugger configured.
I figure I could just point JAVA_HOME
to my Groovy compiler, but is there a better way to do this?
Solution 1:[1]
I had the same problem, so I did the following steps:
- Installation of Groovy. Firstly, I've installed the latest stable pack from the Groovy website. This is basically downloading the pack and unzipping it to a certain local folder.
- Add Groovy bin to PATH variable. Just add the bin folder of the unzipped Groovy pack to the environment variable
PATH
. - Install the
Code Runner extension
for Visual Studio Code. This extension can be downloaded from the VS marketplace. If this is done, then you can at least run the groovy script already. Just open the context menu of the file in the VS Code explorer and clickRun code
.
If you want to debug the script, then you should put it in a java class and debug it as described here.
Solution 2:[2]
My way as of today:
- Install
Java
,Gradle
,Visual Studio Code
with extensionsvscjava.vscode-java-pack
andrichardwillis.vscode-gradle-extension-pack
. - In an empty folder, run
gradle init
, Type of projectapplication
, Implementation languageGroovy
, use defaults for the rest. - Open folder in Visual Studio Code.
- In left toolbar, select the
Gradle
icon, expandapp
,tasks
,application
, selectrun
and click the iconRun task
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | budul |
Solution 2 | GeorgesZ |