feat(run): JAR Application run configurations and their import (#2409)

Fixes #2393

Importing run configurations from .run/ and .idea/ skipped every JarApplication entry because there was no equivalent type. Adds a JAR Application run configuration (path to JAR, VM options, program arguments, JRE, working directory, environment) that runs java [VM options] -jar <jar> [args] and debugs over JDWP like the Application type, and maps JarApplication on import (JAR_PATH, VM/program parameters, working directory, alternative JRE path, envs).
This commit is contained in:
l0ng-ai
2026-11-10 03:28:30 +08:00
committed by GitHub
parent 718e07c831
commit 98cef2aa48
12 changed files with 255 additions and 3 deletions
+10
View File
@@ -46,6 +46,7 @@ export interface JavaCommandLine {
/** VM options, without the classpath. */
vmArgs: string[];
mainClass: string | null;
jarPath?: string;
programArgs: string[];
/** Which classpath placeholder the configuration uses (`null`: an explicit classpath or none). */
classpath: "runtime" | "test" | null;
@@ -60,6 +61,15 @@ export function parseJavaArgs(args: readonly string[]): JavaCommandLine {
let explicitClasspath: string | null = null;
for (let i = 0; i < args.length; i++) {
const a = args[i]!;
if (a === "-jar")
return {
vmArgs,
mainClass: null,
jarPath: args[i + 1],
programArgs: args.slice(i + 2),
classpath,
explicitClasspath,
};
if (a === "-cp" || a === "-classpath" || a === "--class-path") {
const value = args[++i] ?? "";
if (value === CLASSPATH) classpath = "runtime";