From 407d00ffe92b70a13ddb4d92e8444a41ded520cd Mon Sep 17 00:00:00 2001 From: Frederik Hahne Date: Sun, 12 May 2019 21:23:44 +0200 Subject: [PATCH] add classpath jar creation for windows os closes #9713 --- generators/server/templates/build.gradle.ejs | 24 +++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/generators/server/templates/build.gradle.ejs b/generators/server/templates/build.gradle.ejs index 384fc91a9f9b..da64b37ce9ae 100644 --- a/generators/server/templates/build.gradle.ejs +++ b/generators/server/templates/build.gradle.ejs @@ -16,7 +16,9 @@ See the License for the specific language governing permissions and limitations under the License. -%> -buildscript { +import org.gradle.internal.os.OperatingSystem + +buildscript {9713 repositories { mavenLocal() mavenCentral() @@ -96,6 +98,26 @@ eclipse { } } +// See https://virgo47.wordpress.com/2018/09/14/classpath-too-long-with-spring-boot-and-gradle/ for details +// https://github.com/jhipster/generator-jhipster/issues/9713 +if (OperatingSystem.current().isWindows()) { + task classpathJar(type: Jar) { + inputs.files sourceSets.main.runtimeClasspath + + archiveName = "runboot-classpath.jar" + doFirst { + manifest { + def classpath = sourceSets.test.runtimeClasspath.files + attributes "Class-Path": classpath.collect {f -> f.toURI().toString()}.join(" ") + } + } + } + + bootRun { + classpath = classpathJar.outputs.files + } +} + defaultTasks "bootRun" group = "<%= packageName %>"