Skip to content

Commit 4cc6179

Browse files
committed
Add maven check
Signed-off-by: Ian Bolton <[email protected]>
1 parent 61937f0 commit 4cc6179

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

vscode/src/client/analyzerClient.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,17 @@ export class AnalyzerClient {
294294
analyzerRpcServer.stderr.on("data", (data) => {
295295
const asString: string = data.toString().trimEnd();
296296
this.logger.error(`${asString}`);
297-
// Collect stderr for potential Java error detection
297+
// Collect stderr for potential Java/Maven error detection
298298
stderrBuffer += asString + "\n";
299299
});
300300

301-
// Handle exit event with Java error detection
301+
// Handle exit event with Java/Maven error detection
302302
analyzerRpcServer.on("exit", (code, signal) => {
303303
this.logger.info(`Analyzer RPC server terminated [signal: ${signal}, code: ${code}]`);
304304

305305
if (code) {
306306
// Check if it's the specific Java error
307-
if (stderrBuffer.toLowerCase().includes("java is not installed or not on the path")) {
307+
if (stderrBuffer.toLowerCase().includes("java is not installed")) {
308308
// Show user-friendly Java error with action button
309309
vscode.window
310310
.showErrorMessage(
@@ -320,6 +320,23 @@ export class AnalyzerClient {
320320
);
321321
}
322322
});
323+
} else if (stderrBuffer.toLowerCase().includes("maven is not installed")) {
324+
// Show user-friendly Maven error with action button
325+
vscode.window
326+
.showErrorMessage(
327+
"Maven is required for the analyzer server but was not found. " +
328+
"Please install Maven (version 3.6 or later) and ensure the 'mvn' " +
329+
"command is available in your system PATH.",
330+
"Install Maven",
331+
"Maven Setup Guide",
332+
)
333+
.then((selection) => {
334+
if (selection === "Install Maven") {
335+
vscode.env.openExternal(vscode.Uri.parse("https://maven.apache.org/download.cgi"));
336+
} else if (selection === "Maven Setup Guide") {
337+
vscode.env.openExternal(vscode.Uri.parse("https://maven.apache.org/install.html"));
338+
}
339+
});
323340
} else {
324341
// Show generic error as before
325342
vscode.window.showErrorMessage(

0 commit comments

Comments
 (0)