diff --git a/extension/src/views/gradleDaemons/services/GradleLocalInstallation.ts b/extension/src/views/gradleDaemons/services/GradleLocalInstallation.ts index 80434af5b..6f0f1da3b 100644 --- a/extension/src/views/gradleDaemons/services/GradleLocalInstallation.ts +++ b/extension/src/views/gradleDaemons/services/GradleLocalInstallation.ts @@ -1,10 +1,11 @@ import { GradleExecution } from "./GradleExecution"; import { execAsync } from "../../../util/execAsync"; import { getConfigJavaImportGradleJavaHome } from "../../../util/config"; +import * as vscode from "vscode"; export class GradleLocalInstallation implements GradleExecution { private gradleHomePath: string; - + private outputChannel: vscode.OutputChannel; constructor(gradleHomePath: string) { this.gradleHomePath = gradleHomePath; } @@ -22,11 +23,12 @@ export class GradleLocalInstallation implements GradleExecution { const { stdout, stderr } = await execAsync(command, { env }); if (stderr) { - throw new Error(`Error running gradle: ${stderr}`); + this.outputChannel.appendLine(`${stderr}`); + this.outputChannel.show(); } return stdout; } catch (error) { - throw new Error(`Error running gradle: ${error.message}`); + throw new Error(`Error running gradle local installation: ${error.message}`); } } } diff --git a/extension/src/views/gradleDaemons/services/GradleWrapper.ts b/extension/src/views/gradleDaemons/services/GradleWrapper.ts index feeec6861..7a9b8d0ef 100644 --- a/extension/src/views/gradleDaemons/services/GradleWrapper.ts +++ b/extension/src/views/gradleDaemons/services/GradleWrapper.ts @@ -3,12 +3,16 @@ import { execAsync } from "../../../util/execAsync"; import { GradleExecution } from "./GradleExecution"; import * as path from "path"; import { getConfigJavaImportGradleJavaHome } from "../../../util/config"; -import { logger } from "../../../logger"; +import * as vscode from "vscode"; + export class GradleWrapper implements GradleExecution { private gradleWrapperPath: string; + private outputChannel: vscode.OutputChannel; + constructor(private projectRoot: string) { const wrapperName = process.platform === "win32" ? "gradlew.bat" : "gradlew"; this.gradleWrapperPath = path.join(projectRoot, wrapperName); + this.outputChannel = vscode.window.createOutputChannel("Gradle Wrapper"); } public async exec(args: string[]): Promise { @@ -23,14 +27,8 @@ export class GradleWrapper implements GradleExecution { const { stdout, stderr } = await execAsync(command, { cwd: this.projectRoot, env }); if (stderr) { - const stderrLines = stderr.split('\n'); - const isError = stderrLines.some(line => line.toLowerCase().includes('error')); - - if (isError) { - throw new Error(`Error running gradle wrapper: ${stderr}`); - } else { - logger.warn(`Warning: ${stderr}`); - } + this.outputChannel.appendLine(`${stderr}`); + this.outputChannel.show(); } return stdout; } catch (error) {