Giter Site home page Giter Site logo

microsoft / vscode-gradle Goto Github PK

View Code? Open in Web Editor NEW
109.0 13.0 43.0 19.53 MB

Manage Gradle Projects, run Gradle tasks and provide better Gradle file authoring experience in VS Code

Home Page: https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-gradle

License: MIT License

TypeScript 31.07% Java 67.84% JavaScript 0.54% Shell 0.55%
vscode extension gradle gradle-tasks vscode-gradle

vscode-gradle's Introduction

Gradle for Java

Visual Studio Marketplace Installs Build & Publish GitHub bug issues

This VS Code extension provides a visual interface for your Gradle build. You can use this interface to view Gradle Tasks and Project dependencies, or run Gradle Tasks as VS Code Task. The extension also offers better Gradle file (e.g. build.gradle) authoring experience including syntax highlighting, error reporting and auto completion. The extension works nicely alongside other Java extensions in the Extension Pack for Java.

Requirements

Project Discovery

This extension supports both root and nested Gradle projects. A Gradle project is identified by having Gradle Wrapper scripts (gradlew or gradlew.bat) or Gradle build files (build.gradle or settings.gradle and their Kotlin versions) at the root of a directory. (Nested Gradle project discovery is not enabled by default, set "gradle.nestedProjects": true to enable it.)

Feature Overview

Once the extension is activated you will see a new Gradle icon in the activity bar. Clicking on this icon will reveal some tree views in the sidebar.

Protip: you can move drag & drop any of these tree views into the main explorer view for easier access. This is especially useful for pinned tasks.

You can also run any Gradle task as a VS Code task. Access the Gradle VS Code tasks by running Run Task from the command palette.

List projects and tasks

A Gradle build can have one or more projects. Projects are listed in a flat list with the root project listed first, and sub-projects listed alphabetically thereafter.

When you expand a project, tasks are listed in a tree, grouped by the task group. You can toggle the display of the tasks by clicking on the Show Flat List/Show Tree button in the tree view header.

Gradle Tasks View
List project dependencies

The project's dependencies are included in the Dependencies item under the project. The dependencies are grouped by Gradle configurations and you can expand each configuration to find the corresponding ones. For omitted dependency (marked with a (*)), you can use the inline button Go to Omitted Dependency to go to the previously listed dependency.

Gradle Dependencies
Run tasks

Tasks can be run via:

  • Gradle Projects or Recent Tasks tree views
  • Run Task command
  • Run a Gradle Build command

A running task will be shown with an animated "spinner" icon in the tree views, along with Cancel Task & Restart Task buttons. The Cancel Task button will gracefully cancel the task. The Restart Task button will first cancel the task, then restart it.

Gradle Tasks Running

A task will be run a vscode terminal where you can view the task output.

Send a SIGINT signal (ctrl/cmd + c) in the terminal to gracefully cancel it.

Gradle Tasks Output

Tasks run via the Run a Gradle Build command are not reflected in any of the tree views. Use this command to specify your own Gradle build arguments, for example to run multiple tasks or to exclude tasks.

Run Gradle Build
Control task terminal behaviour

Use one terminal for each task type (default):

"gradle.reuseTerminals": "task"

Use one terminal for all tasks:

"gradle.reuseTerminals": "all"

Don't re-use terminals for any tasks. A new terminal will be created for each task run:

"gradle.reuseTerminals": "off"
Debug tasks

This extension provides an experimental feature to debug JavaExec and Test tasks. Before using this feature you need to install the Debugger for Java and Language Support for Java extensions.

You might need to specify whether you want to clean output cache before debugging, to ensure Gradle doesn't skip any tasks due to output caching (this is most useful when debugging tests).

Output cache is cleaned by adding a cleanTaskName task (eg cleanTest) to the build.

You should now see a debug command next to the run command in the Gradle Projects view. The debug command will start the Gradle task with jdwp jvmArgs and start the vscode Java debugger.

Debug Screencast

Pin tasks

As there could be many tasks in a Gradle project, it can be useful to pin commonly used tasks. Pinned tasks will be shown under their project item. Pin a task by accessing the task context menu (by right-clicking a task). You can also pin a task with specific arguments.

Pin a Gradle Task

To unpin a task, access the task context menu and select Unpin Task, or unpin all pinned tasks by clicking on the Unpin all Tasks button in the overflow button of tree view header.

Unpin a Gradle Task
List recent tasks

Recently run Gradle tasks are listed in a separate tree view. This can be useful to see a history of tasks and to easily access the associated task terminals.

The number shown next to the task is the amount of times the task has been run. Click on the Show Terminal button next to a task to view the most recent terminal for that task. Click on the Close Terminal/s button to close the terminal/s for that task.

Click on the Clear Recent Tasks button in the tree view header to remove all recent tasks from the list, or click on the Close All Terminals button to close all task terminals.

Recent Tasks
List & kill Gradle daemons

Gradle daemon processes are listed by their process ID in a separate tree view and can have the following states: IDLE, BUSY, STOPPED, STOPPING, CANCELED.

Stop individual daemons by clicking on the Stop Daemon button next to the listed daemon.

Stop all daemons by clicking on the Stop Daemons button in the tree view header.

Recent Tasks

After stopping a daemon, it will remain in the STOPPED state for a while, but the underlying process won't exist. This is the default Gradle behaviour.

Most of the time there should be no reason to stop a daemon. View more info on the Gradle Daemon from the Gradle website.

The extension uses the Gradle wrapper to list daemons, and is quite a slow process. If the daemon view is not useful for you, you can simply collapse the view, or disable it completely.

Syntax highlighting for Gradle files

When opening a Groovy Gradle file, the Gradle language server will start and provide language features for you.

Basically, we offer a basic groovy syntax highlighting in gradle files, as VS Code does by default. After language server started, it will analyze the Gradle file and provide semantic tokens information, providing more precise highlighting results.

Syntax Highlighting
Document outline for Gradle files

The Gradle language server will provide the document outline for the current Gradle file. This view will help you to navigate to any part of this Gradle file easily.

Document Outline
Error reporting for Gradle files

The Gradle language server will use Groovy compile engine to analyze the Gradle build file and report syntax errors if exist. It will also get script classpaths from Gradle Build so that it can report compilation errors. The Gradle default imports are supported.

Error Reporting
Auto completion for Gradle files

The Gradle language server supports basic auto completions for a Gradle file, including

  • Basic Gradle closures (e.g. dependencies {})
  • Gradle closures from plugins (e.g. java {})
  • Available methods in Gradle closures (e.g. mavenCentral() in dependencies {})
  • Available fields in Gradle closures (e.g. sourceCompatibility in java {})
  • Available dependencies in Maven central when declaring a dependency in dependencies closure
  • Basic auto completion for settings.gradle (e.g. include())
Auto Completion We will continue improving the auto completion feature to support more cases in writing Gradle files.
Full features list
  • List Gradle Tasks & Projects
  • Run Gradle tasks as VS Code tasks
  • View Gradle Dependencies
  • Supports massive Gradle projects (eg with 10000+ tasks)
  • Uses the Gradle Tooling API to discover and run Gradle tasks
  • Uses a long running gRPC server which provides good performance
  • Supports Kotlin & Groovy build files
  • Supports multi-project builds
  • Supports multi-root workspaces
  • Supports nested projects (enabled via setting)
  • Show flat or nested tasks in the explorer
  • Gracefully cancel a running task
  • Debug tasks
  • Run/debug a task with arguments (supports both build & task args, eg gradle tasks --all --info)
  • Pin tasks
  • List recent tasks
  • List & stop daemons
  • Reports Gradle dist download progress
  • Supports syntax highlighting for Groovy Gradle files
  • Supports document outline for Groovy Gradle files
  • Supports error reporting for Groovy Gradle files
  • Supports auto completion for Groovy Gradle files

Extension Settings

This extension contributes the following settings:

  • gradle.autoDetect: Automatically detect Gradle tasks ("on" or "off")
  • gradle.focusTaskInExplorer: Focus the task in the explorer when running a task (boolean)
  • gradle.nestedProjects: Process nested projects (boolean or an array of directories)
  • gradle.reuseTerminals: Reuse task terminals ("task" [default], "all", or "off")
  • gradle.javaDebug.cleanOutput: Clean the task output cache before debugging (boolean)
  • gradle.debug: Show extra debug info in the output panel (boolean)
  • gradle.disableConfirmations: Disable the warning confirm messages when performing batch actions (eg clear tasks, stop daemons etc) (boolean)
  • gradle.allowParallelRun: Allow to run tasks in parallel, each running will create a new terminal. This configuration will override gradle.reuseTerminals and always create new task terminals when running or debugging a task.
  • gradle.projectOpenBehaviour: Specify the default method of opening newly created project ("Interactive", "Open" or "Add to Workspace")
  • java.gradle.buildServer.enabled: Whether to use build server to synchronize Gradle project ("on" or "off")
  • java.gradle.buildServer.openBuildOutput: Controls when the build output should open ("neverOpen", "openOnBuildStart" or "openOnBuildFailure")

Gradle & Java Settings

Set Gradle & Java options with standard environment variables or standard Gradle settings (eg via gradle.properties or task configuration).

Example Environment Variables

  • JAVA_HOME
  • GRADLE_USER_HOME

Note, the VS Code settings take precedence over the environment variables.

Use an environment manager like direnv to set project specific environment variables

Compatibility with the Java language support extension

Java-Specific Settings

This extension supports the following settings which are contributed by the Java language support extension:

  • java.home: (deprecated Please use java.jdt.ls.java.home as given below) Absolute path to JDK home folder used to launch the Gradle daemons

  • java.jdt.ls.java.home: Absolute path to JDK home folder as per the latest VS code, used to launch the Gradle daemons

  • java.import.gradle.java.home: Absolute path to JDK home folder used to launch the Gradle daemons (if set, this value takes precedence over java.home)

  • java.import.gradle.user.home: Setting for GRADLE_USER_HOME

  • java.import.gradle.jvmArguments: JVM arguments to pass to Gradle

    Note: There should be a space between two arguments

  • java.import.gradle.wrapper.enabled: Enable/disable the Gradle wrapper

  • java.import.gradle.version: Gradle version, used if the Gradle wrapper is missing or disabled

  • java.import.gradle.home: Use Gradle from the specified local installation directory or GRADLE_HOME if the Gradle wrapper is missing or disabled and no 'java.import.gradle.version' is specified.

Class References

There are cases where Gradle tasks will generate Java classes. To ensure these Java classes are indexed correctly by the Java language server, you need to ensure the paths are added to the .classpath, and this is typically achieved using Gradle sourceSets.

Once you've configured your sourceSets correctly, follow these steps:

  1. Generate your classes by running the relevant Gradle Task
  2. Force the Language Server to index the generated classes by right-clicking on build.gradle and selecting Update project configuration.

At this point the Gradle sourceSet paths will be added to the .classpath and the Language Server will automatically update references when those classes change.

Extension API

This extension provides an API which can be used by 3rd-party vscode extensions.

πŸ‘‰ Extension API

Troubleshooting

View logs by selecting "Gradle Tasks" in the output panel Gradle extension output
Set the "gradle.debug" setting to "true" to view debug logs in the output panel Gradle extension debug output
Task output will be shown in the Terminal panel Gradle task output
Task output is truncated

The integrated terminal has a limited buffer size and will not show the full output for tasks that generate a large output. Increase the terminal buffer size in your settings, for example:

{
  "terminal.integrated.scrollback": 5000
}
"No connection to the gradle server. Try restarting the server"

This error means the Gradle Task server has stopped, or there was an error starting it. Click on "Restart Server" to restart it.

If you continue to get this error, view the task error messages by selecting "Gradle Tasks" in the output panel.

The task server is started using a shell script generated by CreateStartScripts. The script uses #!/usr/bin/env sh and is as portable as the Gradle wrapper script. If there are any problems executing the start script then it's likely an issue either with your PATH, or Java is not installed.

PATH problems

The following error demonstrates a typical issue with your PATH:

env: sh: No such file or directory
The terminal process terminated with exit code: 127

Use the following task to debug your shell environment within vscode:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Print task shell info",
      "type": "shell",
      "command": "echo \"Path: $PATH \nShell: $SHELL\"",
      "problemMatcher": []
    }
  ]
}

Fixing your $PATH

Check your dotfiles (eg ~/.bash_profile, ~/.bashrc, ~/.zshrc) and fix any broken PATH exports. See Issues with environment vars below for more information.

Java path problems

You might see an error like:

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

The start script should find the path to Java in the usual locations. If you get this error it suggests an issues with your $PATH or you simply haven't installed Java. Run the Gradle wrapper script (eg ./gradlew tasks) to debug further, or see Issues with environment vars below for more information.

Shell environment

Another potential problem is that the PATH or JAVA_HOME environment vars have been defined within .bashrc. See Issues with environment vars below for more information.

Issues with environment vars

(The following is only relevant for MacOS & Linux.)

The Gradle Server is launched inside a non-interactive non-login shell, which loads the profile script (not the rc script). This means the shell will not load, for example, ~/.bashrc. If you've defined PATH or other environment variables within ~/.bashrc, they will not be available for the server startup script and not be available to Gradle.

Generally, environment settings should be defined in in ~/.bash_profile, but as a workaround, you can load ~/.bashrc from within ~/.bash_profilefor example:

if [ -r ~/.bashrc ]; then
  source ~/.bashrc
fi
"Orphaned" Java processes after quitting VS Code

You might notice some Java processes are not closed after existing VS Code. These processes are the Gradle Daemons that Gradle spawns. This is the default behaviour of Gradle.

You'll have N processes per Gradle version. Eventually Gradle will shut them down. Read more about the Gradle Daemon.

Incompatibility with other extensions

This extension is incompatible with the following extensions:

The reason for the incompatibility is due to the extensions providing the same tasks types (gradle) with different task definitions.

Support

Data/Telemetry

VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you don’t wish to send usage data to Microsoft, you can set the telemetry.enableTelemetry setting to false. Learn more in our FAQ.

Contributing

Refer to CONTRIBUTING.md for instructions on how to run the project.

πŸ‘‰ Architecture Overview

Credits

This project was originally started by @badsyntax and is now currently maintained by Microsoft. Huge thanks to @badsyntax who started it all and made this Gradle extension available.

  • Originally forked from Cazzar/vscode-gradle
  • Inspired by the built-in npm extension
  • Thanks to @hanct for providing feature suggestions and BETA testing
  • Thanks to @dcermak for providing inspiration to write some unit tests
  • Thanks to all who have submitted bug reports and feedback

Related Extensions

Check out vscode-spotless-gradle which formats your source files using Spotless & Gradle.

Release Notes

See CHANGELOG.md.

License

See LICENSE.md.

vscode-gradle's People

Contributors

badsyntax avatar bigdaz avatar cazzar avatar cscherryy avatar dependabot-preview[bot] avatar dependabot[bot] avatar donat avatar donniewest avatar electricalboy avatar eskibear avatar gayanper avatar hythloda avatar jamiemagee avatar jdneo avatar joselion avatar kahowell avatar kmcnaught avatar mfussenegger avatar nickzhums avatar ravihara avatar richardwillis-skyscanner avatar snyk-bot avatar testforstephen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-gradle's Issues

VSCode java home not being used

Extension Name: vscode-gradle
Extension Version: 2.4.13
OS Version: Windows 1909
VSCode version: 1.43.2

Describe the bug
The extension doesn't use the java environment set in the workspace settings, instead it defaults to gradle search method, which uses the default system installation.

To Reproduce
Have a system with multiple versions of java (8 and 11 in my pc)
Configure one of them as the default (JAVA_HOME or System Path)
Configure vscode to use the other version with "java.home" setting (provided by Java extension from Red Hat)

Expected behavior
All Gradle tasks should be executed with the java version configured in the vscode "java.home" setting.

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

Test

Extension Name: vscode-gradle
Extension Version:
OS Version:
VSCode version:

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

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

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

Additional context
Add any other context about the problem here.

Provide an easy way to cancel the task refresh process

Is your feature request related to a problem? Please describe.
Sometimes it can take a very long time to list the gradle tasks and I want to cancel that process, but it's not straightforward doing so.

Describe the solution you'd like

  • The refresh icon in the explorer should change to a stop icon.
  • Perhaps add a command

Excessive "restart server" windows

Extension Name: vscode-gradle
Extension Version:
OS Version:
VSCode version:

Describe the bug
When changing java.home or when enabling/disabling the java extension, the "restart server" windows shows.

To Reproduce
See above

Expected behavior
The window should not show. It should only show when the server is unexpectedly stopped.

Screenshots
If applicable, add screenshots to help explain your problem.

Output from "Gradle Tasks"
You can find this by clicking on the "Output" panel, then selecting the "Gradle Tasks" 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.

Gradle daemon still runs after closing vscode

Extension Name: vscode-gradle
Extension Version: 2.4.10
OS Version: Linux 5.5.8-1-ck-skylake
VSCode version: 1.43.0-1

Describe the bug
After opening the project two processes are created:

  1. java -classpath /home/william/.vscode/extensions/richardwillis.vscode-gradle-2.4.13/lib/gradle-tasks-server-all.jar com.github.badsyntax.gradletasks.Application 37391
  2. /usr/lib/jvm/java-13-jdk/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /home/william/.gradle/wrapper/dists/gradle-6.2.2-bin/byfcpklxknejjsdmgq0rkga/gradle-6.2.2/lib/gradle-launcher-6.2.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.2.2

But the latter is still running after exiting vscode.

To Reproduce

  1. Open a gradle project in vscode
  2. Close it

Expected behavior
Exit without any process left.

Output from "Gradle Tasks"
None.

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

Additional context
None

Extension hangs on "refreshing tasks" when server goes down

Describe the bug
If, for whatever reason, the gradle server goes down, and you try refresh the tasks, the status bar displays "Gradle: Refreshing Tasks" and it just hangs.

To Reproduce
Open "Developer: Open Process Explorer" and find the "gradle-tasks" java process, and kill the process. Then click on the "refresh" icon in the gradle explorer view.

Expected behavior
The tasks are refreshed and the status bar is cleared.

Desired implementation
Re-start the server if connection is lost.

Consider converting server to a language server

I should be using a standard protocol (language server protocol) for discovering and running tasks.

A language server for java exists here: https://github.com/redhat-developer/vscode-java I can build a custom eclipse.jdt.ls extension to integrate with the java language server, but that limits this extension to just java, where gradle supports many other languages.

No "gradle language server" exists, as far as I can tell, but that seems the right way to go.

Run debug with a single command/click

Extension Name: vscode-gradle
Extension Version: v2.4.13
OS Version: Windows 10
VSCode version:1.43.2

Current Situation:
I am able to debug spring boot application (or any java-based application) in vscode by doing the below 2 things

  1. Run the gradle task called bootRun. Note that the build.gradle is configured with this
    bootRun {
    jvmArgs=["-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=32323"]
    }

  2. With the below configured in the launch.json, run the configuration to attach the debugger to the listener port 32323.
    {
    "type": "java",
    "name": "Debug (Attach1`)",
    "request": "attach",
    "hostName": "localhost",
    "port": 32323
    }

Finally, i can see my vscode break at my custom breakpoint in the code editor.

However, everytime i make a changes to the Java code, i have to stop everything above, and rerun the 2 steps. It is really tedious. Is there a way to run the above 2 steps with just one single command or a single button click.

Improve the error handling

Previously we were logging the full command to the output channel. This was useful in debugging refresh tasks issues. Since we moved to using spawn we're now only logging the command without args.

  • The full command, including arguments, and process options, must be logged to the output channel.
  • Unit tests are added to cover this case

No tasks detected for Gradle

Describe the bug

No tasks are appearing when I refresh the tasks view. From everything else I've seen, it looks like Gradle is working fine. I'm running Windows and I've tested (unsuccessfully) using the latest VS Code version on Windows native as well as running under WSL. Output below along with build.gradle content.

Disclaimer: I'm new to Gradle and also new to this extension.

To Reproduce

  1. created ./build.gradle file with the following text:
plugins {
    id "base"
}

task zip(type: Zip, description: "Archive project definition as a zip") {
    from "data"
    setArchiveFileName "project.zip"
}
  1. created ./settings.gradle with the following text:
rootProject.name = 'dataops-project-template'

(dataops-project-template is the name of the project and root directory)

  1. run gradle tasks and confirm zip is in the list.

  2. run ./gradlew version:

------------------------------------------------------------
Gradle 6.0.1
------------------------------------------------------------

Build time:   2019-11-18 20:25:01 UTC
Revision:     fad121066a68c4701acd362daf4287a7c309a0f5

Kotlin:       1.3.50
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.5 (Private Build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)
OS:           Linux 4.19.84-microsoft-standard amd64

Expected behavior

Expected to see gradle tasks (at least my custom task zip) in the "Gradle Tasks" pane.

Screenshots

...

Environment (please complete the following information):

  • OS: Tested on Windows (latest insider:slow, and WSL (Ubuntu 18.04)

Output from "Gradle Tasks"

{"type":"GRADLE_PROGRESS","message":"Build"}
{"type":"GRADLE_PROGRESS","message":"Connecting to Gradle Daemon"}
{"type":"GRADLE_PROGRESS","message":"Build"}
{"type":"GRADLE_PROGRESS","message":"Run build"}
{"type":"GRADLE_PROGRESS","message":"Evaluate settings"}
{"type":"GRADLE_PROGRESS","message":"Run build"}
{"type":"GRADLE_PROGRESS","message":"Configure build"}
{"type":"GRADLE_PROGRESS","message":"Load projects"}
{"type":"GRADLE_PROGRESS","message":"Configure build"}
{"type":"GRADLE_PROGRESS","message":"Configure project :"}
{"type":"GRADLE_PROGRESS","message":"Configure build"}
{"type":"GRADLE_PROGRESS","message":"Run build"}
{"type":"GRADLE_PROGRESS","message":"Build model 'org.gradle.tooling.model.GradleProject' for root project 'dataops-project-template'"}
{"type":"GRADLE_PROGRESS","message":"Run build"}
{"type":"GRADLE_PROGRESS","message":"Build"}
{"type":"GRADLE_PROGRESS","message":"Deleting unused version-specific caches in C:\\Files\\Source\\dataops-project-template\\.gradle"}
{"type":"GRADLE_PROGRESS","message":"Build"}
{"type":"GRADLE_OUTPUT","message":"","outputType":"STDOUT"}

{"type":"GRADLE_OUTPUT","message":"\nCONFIGURE SUCCESSFUL in 72ms","outputType":"STDOUT"}

CONFIGURE SUCCESSFUL in 72ms
{"type":"GRADLE_PROGRESS","message":""}

{
    "type": "GRADLE_TASKS",
    "tasks": [
      {
        "name": "assemble",
        "group": "build",
        "path": ":assemble",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Assembles the outputs of this project."
      },
      {
        "name": "build",
        "group": "build",
        "path": ":build",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Assembles and tests this project."
      },
      {
        "name": "buildEnvironment",
        "group": "help",
        "path": ":buildEnvironment",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Displays all buildscript dependencies declared in root project 'dataops-project-template'."
      },
      {
        "name": "check",
        "group": "verification",
        "path": ":check",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Runs all checks."
      },
      {
        "name": "clean",
        "group": "build",
        "path": ":clean",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Deletes the build directory."
      },
      {
        "name": "components",
        "group": "help",
        "path": ":components",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Displays the components produced by root project 'dataops-project-template'. [incubating]"
      },
      {
        "name": "dependencies",
        "group": "help",
        "path": ":dependencies",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Displays all dependencies declared in root project 'dataops-project-template'."
      },
      {
        "name": "dependencyInsight",
        "group": "help",
        "path": ":dependencyInsight",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Displays the insight into a specific dependency in root project 'dataops-project-template'."
      },
      {
        "name": "dependentComponents",
        "group": "help",
        "path": ":dependentComponents",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Displays the dependent components of components in root project 'dataops-project-template'. [incubating]"
      },
      {
        "name": "help",
        "group": "help",
        "path": ":help",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Displays a help message."
      },
      {
        "name": "init",
        "group": "Build Setup",
        "path": ":init",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Initializes a new Gradle build."
      },
      {
        "name": "model",
        "group": "help",
        "path": ":model",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Displays the configuration model of root project 'dataops-project-template'. [incubating]"
      },
      {
        "name": "outgoingVariants",
        "group": "help",
        "path": ":outgoingVariants",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Displays the outgoing variants of root project 'dataops-project-template'."
      },
      {
        "name": "prepareKotlinBuildScriptModel",
        "group": null,
        "path": ":prepareKotlinBuildScriptModel",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": null
      },
      {
        "name": "projects",
        "group": "help",
        "path": ":projects",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Displays the sub-projects of root project 'dataops-project-template'."
      },
      {
        "name": "properties",
        "group": "help",
        "path": ":properties",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Displays the properties of root project 'dataops-project-template'."
      },
      {
        "name": "tasks",
        "group": "help",
        "path": ":tasks",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Displays the tasks runnable from root project 'dataops-project-template'."
      },
      {
        "name": "wrapper",
        "group": "Build Setup",
        "path": ":wrapper",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Generates Gradle wrapper files."
      },
      {
        "name": "zip",
        "group": null,
        "path": ":zip",
        "project": "dataops-project-template",
        "buildFile": "C:\\Files\\Source\\dataops-project-template\\build.gradle",
        "rootProject": "dataops-project-template",
        "description": "Archive project definition as a zip"
      }
    ]
  }

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

I'm not sure how to test this but I tried disabling all task-related extentions and I still get the same result.

Additional context

Add any other context about the problem here.

Cannot read property '0' of undefined

Describe the bug
It crashes with following error:

TypeError: Cannot read property '0' of undefined
	at Function.file (/opt/visual-studio-code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:126)
	at /home/theaifam5/.vscode-java/richardwillis.vscode-gradle-2.2.6/out/gradleView.js:264
	at Array.forEach (<anonymous>)
	at GradleTasksTreeDataProvider.buildTaskTree (/home/theaifam5/.vscode-java/richardwillis.vscode-gradle-2.2.6/out/gradleView.js:241)
	at GradleTasksTreeDataProvider.<anonymous> (/home/theaifam5/.vscode-java/richardwillis.vscode-gradle-2.2.6/out/gradleView.js:207)
	at Generator.next (<anonymous>)
	at fulfilled (/home/theaifam5/.vscode-java/richardwillis.vscode-gradle-2.2.6/out/gradleView.js:5)
onDidNotificationChange @ notificationsAlerts.ts:38
notificationsAlerts.ts:38 TypeError: Cannot read property '0' of undefined
	at Function.file (/opt/visual-studio-code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:126)
	at /home/theaifam5/.vscode-java/richardwillis.vscode-gradle-2.2.6/out/gradleView.js:264
	at Array.forEach (<anonymous>)
	at GradleTasksTreeDataProvider.buildTaskTree (/home/theaifam5/.vscode-java/richardwillis.vscode-gradle-2.2.6/out/gradleView.js:241)
	at GradleTasksTreeDataProvider.<anonymous> (/home/theaifam5/.vscode-java/richardwillis.vscode-gradle-2.2.6/out/gradleView.js:207)
	at Generator.next (<anonymous>)
	at fulfilled (/home/theaifam5/.vscode-java/richardwillis.vscode-gradle-2.2.6/out/gradleView.js:5)
	at o (/home/theaifam5/.vscode-java/vscjava.vscode-java-test-0.22.0/dist/extension.bundle.js:9)
	at /home/theaifam5/.vscode-java/vscjava.vscode-java-test-0.22.0/dist/extension.bundle.js:9

Crashes in that scope:
https://github.com/badsyntax/vscode-gradle/blob/9c248eff1c6ebe79bc6d3185caa60d787329aa7a/src/gradleView.ts#L340

To Reproduce
Use example from https://github.com/FabricMC/fabric-example-mod.

Expected behavior
Should show gradle tasks.

Screenshots
image

Environment:

  • OS: ArchLinux
  • Java:
openjdk 11.0.5 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10)
OpenJDK 64-Bit Server VM (build 11.0.5+10, mixed mode)
  • Gradle: 5.5.1

Output from "Gradle Tasks"

./gradle-tasks /home/theaifam5/Documents/Projects/TheAifam5/Java/example-fabric-mod /tmp/vscode-gradle-4QurBq/tasks.json
.........................................
> Configure project :
Fabric Loom: 0.2.7-SNAPSHOT Build(jenkins #9)
:setting up loom dependencies
:setting up mappings (yarn 1.15+build.2)
....
CONFIGURE SUCCESSFUL in 741ms
..............................................
> Configure project :
Fabric Loom: 0.2.7-SNAPSHOT Build(jenkins #9)
:setting up loom dependencies
:setting up mappings (yarn 1.15+build.2)

CONFIGURE SUCCESSFUL in 289ms
.
Successfully written: /tmp/vscode-gradle-4QurBq/tasks.json

Additional context
/tmp/vscode-gradle-2r3NWD/tasks.json:
output.zip

Sort projects in treeview

When working with complex projects that contain nested gradle projects & multi-projects, it would be useful to list the multi-projects first (ie projects from root) then list the nested projects.

Missing customization of GRADLE_USER_HOME

Extension Name: vscode-gradle
Extension Version: v2.4.13
OS Version: windows 10
VSCode version: v1.43.2

May i know if there is any way to configure GRADLE_USER_HOME for this vscode-gradle extension to recognize? This extension seem to be missing the customization for this variable.

Note that I avoid setting this in my machine's environment variables, and would prefer to do it in the vscode instead. I have also installed vscode-java extension pack, and has configured java.import.gradle.user.home, but sadly no effect for vscode-gradle. This is not surprising as this setting is pertaining to the vscode-java extension , not vscode-gradle extension.

Add release notes

Now that the extension is finally stabilising we should show what features were added in release notes.

No support for kotlin build file

The extension will only search for build.gradle (groovy style). It would be useful if the extension also supported the kotlin version of the build file.

Ability to supply custom args when running tasks

Is your feature request related to a problem? Please describe.
Currently it's not possible to add custom args when running tasks. An example of this is running the "tasks" task which can take an "--all" argument.

Describe the solution you'd like
Perhaps a context menu option to "Run task with args" which then displays an input box to get the args.

Code snippets to create gradle task

Is your feature request related to a problem? Please describe.
It would be useful to provide some basic code snippets for providing the syntax to create new tasks.

Describe the solution you'd like
Provide the snippets to create a new task. Should support both groovy and kotlin syntaxes. Provide an option in the context menu to create a new task.

Add ability to kill task process from the explorer

Is your feature request related to a problem? Please describe.
When running long running tasks from the explorer it would be useful to be able to kill the process from the same area in the explorer view.

Describe the solution you'd like
Similar to the vscode-taskeplorer, it would be useful to have a "stop" icon within the explorer view.

Screenshot 2019-11-18 at 08 44 21

Describe alternatives you've considered
An alternative approach is to not provide this feature and add a note to the README explaining how to terminate a task from the command palette:

Screenshot 2019-11-18 at 08 45 49

Screenshot 2019-11-18 at 08 45 36

Additional context
We see the npm extension has a play icon so this change is somewhat consistent with standard vscode extensions.

Screenshot 2019-11-18 at 08 48 06

To begin, just replace the play icon with a stop icon when the process is running. I do like the progress & refresh icons too, but those are "nice to haves".

Task cancellation state hanging in explorer

Describe the bug
If you click on "stop task" just after the task has stopped, the task state in the explorer is stuck in a cancelling state. See screenshots below.

Screenshots

Screenshot 2019-12-23 at 10 56 10

You can click on "refresh tasks" to fix but it's not ideal and should be fixed.

Better feedback

Is your feature request related to a problem? Please describe.
Sometimes it can take a very long time to refresh the tasks. This can be due to any number of reasons, for example: the gradle wrapper is downloading; project dependencies are downloading; kotlin is downloading; project is building etc etc

Describe the solution you'd like
Like other IDEs, it might be useful to show what gradle is actually doing when refreshing tasks. We can show status by pulling description from the gradle progress event.
Ideally we'd like to show the same progress when executing a task, so explore the possibility of doing so, but create a new ticket if it requires a bit refactor.

Extension issue

  • Issue Type: Bug
  • Extension Name: vscode-gradle
  • Extension Version: 2.4.3
  • OS Version: Windows_NT x64 10.0.19041
  • VSCode version: 1.41.1

⚠️ We have written the needed data into your clipboard. Please paste! ⚠️

No connection to the gradle server. Try restarting the server.

Describe the bug
I just started seeing this error reported in VSCode yesterday. If I disable the extension obviously the errors stop appearing. Directly beneath that error dialog in VSCode is a second one that says: "The terminal process terminated with exit code: 127"

I haven't added any new extensions to my development environment in the last week or so. According the the VSCode extension, it is running v2.4.2. Any idea what may be going on? I'm happy to provide additional detail as needed.

To Reproduce
Start VS Code, allow for all analysis and extensions to load.

Expected behavior
There should be no error dialogs.
Screen Shot 2020-01-01 at 6 18 22 PM

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: Mac OS

Output from "Gradle Tasks"
Gradle server started
Gradle client connecting to server...
Gradle server stopped
WebSocketClient: retry in 5000ms
WebSocketClient: reconnecting...
WebSocketClient: retry in 5000ms
ad infinitum

Does the bug still exist if you disable all other extensions?
Haven't checked yet

Additional context

Scroll gradle tree to task position when running task

Is your feature request related to a problem? Please describe.

  • I run a task using the command pallet
  • I want to quickly re-run that task
  • Task is not shown in the explorer

Describe the solution you'd like
scroll the explorer to the task position

Describe alternatives you've considered
U can use the command history to quickly re-run the previous task but IMO it would also be useful to scroll the explorer to the task position too.

Update java project configuration after running tasks

Refs: microsoft/vscode-java-pack#347 (comment)

Is your feature request related to a problem? Please describe.
When running gradle tasks. the editor does not sync the changes. For example, if new classes are generated, they are not reflected in the editor.

Describe the solution you'd like
I want to see updated classpaths in the editor.

Additional context
You can replicate this by, for example, generating classes from protos.

Solution: execute command provided from vscode-java to "updateProjectConfiguration" after running tasks.

Cannot run task on Win when using Bash as default terminal

I use VSC on Windows 10 and configured the git bash as default terminal.

As a task gets executed by the extension as c:\ieu\development\myProject\gradlew.bat tasks in the bash terminal, it results in a effective call of
/usr/bin/bash: c:ieumyProjectgradlew.bat task which obviously results in a failure.

  1. Allow a different terminal for the extension to execute the tasks
  2. Avoid accidental escaping of chars in a unix terminal when passing a windows path

Incorrect parsing logic

I've seeing some invalid tasks being listed, like "Rules". This is due to the very relaxed regex.

Add tests to cover these these cases.

No gradle tasks show up from me

Extension Name: vscode-gradle
Extension Version: latest
OS Version: Mac
VSCode version: latest stable

Describe the bug
No gradle tasks show up for me. I can see them under tasks explorer but not gradle tasks

To Reproduce
Open java project.

Expected behavior
Gradle tasks to show up.

Screenshots
image

Output from "Gradle Tasks"
[info] Gradle server started
[info] Gradle client connecting to server...
[info] WebSocketClient: retry in 1000ms
[info] Connected to 127.0.0.1:57312. Welcome client!
[info] CONFIGURE SUCCESSFUL in 9s
[info] CONFIGURE SUCCESSFUL in 128ms

Nested tasks by group

Is your feature request related to a problem? Please describe.
Currently the tasks are listed without any grouping. It would be useful to show the tasks in their respective groups.

Describe the solution you'd like
Show a grouped nesting in the explorer view.

Task indexing error for sub-projects

Describe the bug
Extension fails on ./gradlew --quiet tasks --all when refreshing task list of gradle root and sub-projects. Command works when executed manually in terminal. I prepared sample app that I attach to the issue.
demo.zip

To Reproduce

  1. Open attached project in VS Code.
  2. Check the output of Gradle Tasks.

Expected behavior
Refresh operation completes and gradle tasks are visible on the side bar.

Environment:

  • OS: macOS 10.15.1 (19B88)
  • VS Code version: 1.40.1
  • Extension version: 2.1.9

Output from "Gradle Tasks"

Executing: ./gradlew --quiet tasks --all
Error providing gradle tasks: Cannot read property 'fsPath' of undefined

Add config to disable searching for nested projects

Is your feature request related to a problem? Please describe.
When working on the extension, it finds takes for all the test fixture projects. This is dist acting for me and not something I want the extension to do.

Describe the solution you'd like
A config setting to disable the feature of finding nested gradle projects.

Relative Paths in the project gradle.properties do not work

Extension Name: vscode-gradle
Extension Version: 2.4.13
OS Version: Windows 10
VSCode version: 1.43.2

Describe the bug
We add an entry in the gradle.properties file to override the trust authority to use our local artifact repository instead of Maven Central. Executing using the gradle wrapper from Command prompt works fine. Executing from the Gradle Tasks explorer gives the error that it can't find the cacerts file specified. If we give full path in the properties file, then it works. This is not acceptable for our processes.

Update: Looks like it is executing the tasks from the /User//.vscode/extensions/... directory when applying the Java parameter to set the truststore. I'm guessing Java parameters are being parsed/applied in different context than other gradle.properties values.

To Reproduce
Define a relative path in the gradle.properties file of any project. Execute from the Gradle Tasks Explorer.

Expected behavior
Relative paths should be supported from within gradle.properties file.

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

Additional context
Add any other context about the problem here.

Can't show/refresh tasks

We have a relatively big gradle project with subrojects. The extension is unable to show available tasks:
stdout maxBuffer length exceededExecuting: /home///gradlew --console plain tasks --all

Replace websockets + protobuf with GRPC

Already using protobuf and not a fan of how the messages are handled nor the complicated client. Have already wasted a lot of time trying to find the right abstractions for the messaging protocol. All of these problems are solved by using grpc (or json-rpc).
Only hesitation is file size but i don't consider it a blocker for this feature.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.