From 6df038a93a01a31f2ddf2b6572b61b29d0ea4e6d Mon Sep 17 00:00:00 2001 From: BoykoAlex Date: Tue, 1 Nov 2016 18:34:36 -0400 Subject: [PATCH] Switch fat jar packaging to boot repackaging instead of jar shading --- .../vscode-application-properties/lib/Main.ts | 27 ++++--------------- .../vscode-application-properties/pom.xml | 22 +++------------ .../vscode-application-yaml/lib/Main.ts | 25 +++-------------- .../vscode-application-yaml/pom.xml | 22 +++------------ .../vscode-manifest-yaml/lib/Main.ts | 25 +++-------------- .../vscode-manifest-yaml/pom.xml | 22 +++------------ 6 files changed, 23 insertions(+), 120 deletions(-) diff --git a/vscode-extensions/vscode-application-properties/lib/Main.ts b/vscode-extensions/vscode-application-properties/lib/Main.ts index c691bc936..68c369e38 100644 --- a/vscode-extensions/vscode-application-properties/lib/Main.ts +++ b/vscode-extensions/vscode-application-properties/lib/Main.ts @@ -21,25 +21,6 @@ const DEBUG_ARG = '-agentlib:jdwp=transport=dt_socket,server=y,address=8000,susp // - we launch the Java project directly from the classes folder produced by Eclipse JDT compiler // - we add DEBUG_ARG to the launch so that remote debugger can attach on port 8000 -function getClasspath(context: VSCode.ExtensionContext):string { - if (DEBUG) { - try { - let projectDir = context.extensionPath; - let classpathFile = Path.resolve(projectDir, "classpath.txt"); - //TODO: async read? - let classpath = FS.readFileSync(classpathFile, 'utf8'); - classpath = Path.resolve(projectDir, 'target/classes') + ':' + classpath; - return classpath; - } catch (e) { - //Expected if you classpath.txt file isn't packaged. So this means we are running in packaged mode. - VSCode.window.showInformationMessage('classpath file not found, so disabling DEBUG mode '+e); - //Nasty! Be careful, this assumes 'getClasspath' is called before computing debug args. - DEBUG = false; - } - } - return Path.resolve(context.extensionPath, "out", "fat-jar.jar"); -} - /** Called when extension is activated */ export function activate(context: VSCode.ExtensionContext) { let javaExecutablePath = findJavaExecutable('java'); @@ -101,11 +82,13 @@ export function activate(context: VSCode.ExtensionContext) { cwd: VSCode.workspace.rootPath }; let child: ChildProcess.ChildProcess; - let classpath = getClasspath(context); + // let classpath = getClasspath(context); + let projectDir = context.extensionPath; + let fatJar = Path.resolve(projectDir, 'target/vscode-application-properties-0.0.1-SNAPSHOT.jar'); let args = [ '-Dserver.port=' + port, - '-cp', classpath, - 'org.springframework.ide.vscode.application.properties.Main' + '-jar', + fatJar, ]; if (DEBUG) { args.unshift(DEBUG_ARG); diff --git a/vscode-extensions/vscode-application-properties/pom.xml b/vscode-extensions/vscode-application-properties/pom.xml index 6c1c36028..7bea98059 100644 --- a/vscode-extensions/vscode-application-properties/pom.xml +++ b/vscode-extensions/vscode-application-properties/pom.xml @@ -109,27 +109,13 @@ - org.apache.maven.plugins - maven-shade-plugin - 2.4.1 - - ${project.basedir}/out/fat-jar.jar - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - + org.springframework.boot + spring-boot-maven-plugin + 1.4.1.RELEASE - package - shade + repackage diff --git a/vscode-extensions/vscode-application-yaml/lib/Main.ts b/vscode-extensions/vscode-application-yaml/lib/Main.ts index 314d81ba9..d4f68d415 100644 --- a/vscode-extensions/vscode-application-yaml/lib/Main.ts +++ b/vscode-extensions/vscode-application-yaml/lib/Main.ts @@ -21,25 +21,6 @@ const DEBUG_ARG = '-agentlib:jdwp=transport=dt_socket,server=y,address=8000,susp // - we launch the Java project directly from the classes folder produced by Eclipse JDT compiler // - we add DEBUG_ARG to the launch so that remote debugger can attach on port 8000 -function getClasspath(context: VSCode.ExtensionContext):string { - if (DEBUG) { - try { - let projectDir = context.extensionPath; - let classpathFile = Path.resolve(projectDir, "classpath.txt"); - //TODO: async read? - let classpath = FS.readFileSync(classpathFile, 'utf8'); - classpath = Path.resolve(projectDir, 'target/classes') + ':' + classpath; - return classpath; - } catch (e) { - //Expected if you classpath.txt file isn't packaged. So this means we are running in packaged mode. - VSCode.window.showInformationMessage('classpath file not found, so disabling DEBUG mode '+e); - //Nasty! Be careful, this assumes 'getClasspath' is called before computing debug args. - DEBUG = false; - } - } - return Path.resolve(context.extensionPath, "out", "fat-jar.jar"); -} - /** Called when extension is activated */ export function activate(context: VSCode.ExtensionContext) { let javaExecutablePath = findJavaExecutable('java'); @@ -99,11 +80,11 @@ export function activate(context: VSCode.ExtensionContext) { cwd: VSCode.workspace.rootPath }; let child: ChildProcess.ChildProcess; - let classpath = getClasspath(context); + let fatJarFile = Path.resolve(context.extensionPath, 'target/vscode-application-yaml-0.0.1-SNAPSHOT.jar'); let args = [ '-Dserver.port=' + port, - '-cp', classpath, - 'org.springframework.ide.vscode.application.yaml.Main' + '-jar', + fatJarFile, ]; if (DEBUG) { args.unshift(DEBUG_ARG); diff --git a/vscode-extensions/vscode-application-yaml/pom.xml b/vscode-extensions/vscode-application-yaml/pom.xml index 914637c73..693238086 100644 --- a/vscode-extensions/vscode-application-yaml/pom.xml +++ b/vscode-extensions/vscode-application-yaml/pom.xml @@ -121,27 +121,13 @@ - org.apache.maven.plugins - maven-shade-plugin - 2.4.1 - - ${project.basedir}/out/fat-jar.jar - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - + org.springframework.boot + spring-boot-maven-plugin + 1.4.1.RELEASE - package - shade + repackage diff --git a/vscode-extensions/vscode-manifest-yaml/lib/Main.ts b/vscode-extensions/vscode-manifest-yaml/lib/Main.ts index d83227beb..c30406ad8 100644 --- a/vscode-extensions/vscode-manifest-yaml/lib/Main.ts +++ b/vscode-extensions/vscode-manifest-yaml/lib/Main.ts @@ -21,25 +21,6 @@ const DEBUG_ARG = '-agentlib:jdwp=transport=dt_socket,server=y,address=8000,susp // - we launch the Java project directly from the classes folder produced by Eclipse JDT compiler // - we add DEBUG_ARG to the launch so that remote debugger can attach on port 8000 -function getClasspath(context: VSCode.ExtensionContext):string { - if (DEBUG) { - try { - let projectDir = context.extensionPath; - let classpathFile = Path.resolve(projectDir, "classpath.txt"); - //TODO: async read? - let classpath = FS.readFileSync(classpathFile, 'utf8'); - classpath = Path.resolve(projectDir, 'target/classes') + ':' + classpath; - return classpath; - } catch (e) { - //Expected if you classpath.txt file isn't packaged. So this means we are running in packaged mode. - VSCode.window.showInformationMessage('classpath file not found, so disabling DEBUG mode '+e); - //Nasty! Be careful, this assumes 'getClasspath' is called before computing debug args. - DEBUG = false; - } - } - return Path.resolve(context.extensionPath, "out", "fat-jar.jar"); -} - /** Called when extension is activated */ export function activate(context: VSCode.ExtensionContext) { VSCode.window.showInformationMessage("Activating manifet.yml extension"); @@ -100,11 +81,11 @@ export function activate(context: VSCode.ExtensionContext) { cwd: VSCode.workspace.rootPath }; let child: ChildProcess.ChildProcess; - let classpath = getClasspath(context); + let fatJarFile = Path.resolve(context.extensionPath, 'target/vscode-manifest-yaml-0.0.1-SNAPSHOT.jar'); let args = [ '-Dserver.port=' + port, - '-cp', classpath, - 'org.springframework.ide.vscode.manifest.yaml.Main' + '-jar', + fatJarFile, ]; if (DEBUG) { args.unshift(DEBUG_ARG); diff --git a/vscode-extensions/vscode-manifest-yaml/pom.xml b/vscode-extensions/vscode-manifest-yaml/pom.xml index de178b687..646bc6353 100644 --- a/vscode-extensions/vscode-manifest-yaml/pom.xml +++ b/vscode-extensions/vscode-manifest-yaml/pom.xml @@ -82,27 +82,13 @@ - org.apache.maven.plugins - maven-shade-plugin - 2.4.1 - - ${project.basedir}/out/fat-jar.jar - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - + org.springframework.boot + spring-boot-maven-plugin + 1.4.1.RELEASE - package - shade + repackage