Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Spring Boot Dashboard is a lightweight extension in Visual Studio Code (VS Code)
* View Spring Boot apps in workspace
* Start / Stop a Spring Boot app
* Debug a Spring Boot app
* Delegate local Run / Debug / Stop actions to Gradle tasks
* Open a Spring Boot app in browser
* List beans/endpoint mappings
* View bean dependencies
Expand All @@ -39,6 +40,17 @@ ext install vscode-spring-boot-dashboard
- Right click on a certain app and choose to start, stop or debug it
- Right click on a certain app and open the website in a browser

## Gradle launch strategy

Spring Boot Dashboard can now launch local apps through either the default Java debugger flow or delegated Gradle tasks.

Set `spring.dashboard.launchStrategy` to `gradle` to have Run / Debug / Stop actions execute Gradle tasks instead of VS Code's Java launch flow.

- `spring.dashboard.gradle.task`: Gradle task used for Run, defaults to `bootRun`
- `spring.dashboard.gradle.debugTask`: optional Gradle task used for Debug; if empty, the Run task is reused

Both plain task names such as `bootRun` and fully qualified task paths such as `:service:bootRun` are supported. The dashboard will use the Gradle wrapper when available, and otherwise falls back to a `gradle` executable on your `PATH`.

## Data/Telemetry
VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our [privacy statement](http://go.microsoft.com/fwlink/?LinkId=521839) 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](https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting).

Expand Down
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,32 @@
{
"title": "Spring Boot Dashboard",
"properties": {
"spring.dashboard.launchStrategy": {
"default": "java",
"type": "string",
"enum": [
"java",
"gradle"
],
"enumDescriptions": [
"Launch Spring Boot apps using the Java debugger's launch configuration flow.",
"Delegate local Spring Boot Run/Debug/Stop actions to Gradle tasks."
],
"scope": "window",
"description": "Defines how local Spring Boot apps are started from the dashboard."
},
"spring.dashboard.gradle.task": {
"default": "bootRun",
"type": "string",
"scope": "window",
"description": "Gradle task used when launchStrategy is set to gradle. Supports plain task names such as bootRun and fully qualified task paths such as :service:bootRun."
},
"spring.dashboard.gradle.debugTask": {
"default": "",
"type": "string",
"scope": "window",
"description": "Optional Gradle task used for Debug when launchStrategy is set to gradle. If empty, spring.dashboard.gradle.task is reused."
},
"spring.dashboard.openWith": {
"default": "integrated",
"type": "string",
Expand Down
48 changes: 48 additions & 0 deletions src/BootApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import * as vscode from "vscode";
import { dashboard } from "./global";
import { DebugSessionRole, GradleLaunchPhase, LaunchStrategy } from "./launchUtils";
import { requestWorkspaceSymbols } from "./models/stsApi";
import { ClassPathData, MainClassData } from "./types/jdtls";
import { isActuatorJarFile, isAlive } from "./utils";
Expand All @@ -25,13 +26,33 @@ export enum AppState {
RUNNING = 'running'
}

export interface GradleLaunchState {
launchStrategy: LaunchStrategy;
pendingMainClass?: string;
taskExecution?: vscode.TaskExecution;
taskPath?: string;
taskId?: string;
jmxPort?: number;
debugPort?: number;
attachSessionName?: string;
attachSessionId?: string;
initScriptUri?: vscode.Uri;
phase: GradleLaunchPhase;
sessionRole?: DebugSessionRole;
}

export class BootApp {
private _activeSessionName?: string;
private _jmxPort?: number;
private _port?: number;
private _contextPath?: string;
private _pid?: number;
private _activeProfiles?: string[];
private _launchStrategy: LaunchStrategy = "java";
private _gradleLaunch: GradleLaunchState = {
launchStrategy: "java",
phase: "idle",
};

private _watchdog?: NodeJS.Timeout; // used to watch running process.

Expand Down Expand Up @@ -124,6 +145,33 @@ export class BootApp {
this._activeProfiles = profiles;
}

public get launchStrategy(): LaunchStrategy {
return this._launchStrategy;
}

public set launchStrategy(strategy: LaunchStrategy) {
this._launchStrategy = strategy;
}

public get gradleLaunch(): GradleLaunchState {
return this._gradleLaunch;
}

public set gradleLaunch(launch: GradleLaunchState) {
this._gradleLaunch = launch;
}

public clearGradleLaunch(): void {
this._gradleLaunch = {
launchStrategy: "java",
phase: "idle",
};
}

public get hasActiveGradleLaunch(): boolean {
return this._gradleLaunch.phase !== "idle" || this._gradleLaunch.taskExecution !== undefined;
}

public get contextPath(): string | undefined {
return this._contextPath;
}
Expand Down
Loading