From 306c9a67cba72f72fd471e894542466b17249946 Mon Sep 17 00:00:00 2001 From: Matthew Nesbit Date: Mon, 16 May 2016 13:48:09 +0100 Subject: [PATCH] Force wildcard classpath into generated windows startup scripts to prevent 'command line too long' issues --- build.gradle | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a6d23adc24..99a2b61b4d 100644 --- a/build.gradle +++ b/build.gradle @@ -18,6 +18,7 @@ buildscript { ext.artemis_version = '1.2.0' ext.jetty_version = '9.1.1.v20140108' ext.jersey_version = '2.22.2' + ext.jolokia_version = '2.0.0-M1' repositories { mavenCentral() @@ -89,7 +90,7 @@ dependencies { compile "org.eclipse.jetty:jetty-servlet:${jetty_version}" compile "org.eclipse.jetty:jetty-webapp:${jetty_version}" compile "javax.servlet:javax.servlet-api:3.1.0" - compile "org.jolokia:jolokia-agent-war:2.0.0-M1" + compile "org.jolokia:jolokia-agent-war:${jolokia_version}" compile "commons-fileupload:commons-fileupload:1.3.1" // Jersey for JAX-RS implementation for use in Jetty @@ -157,6 +158,18 @@ task getIRSDemo(type: CreateStartScripts) { classpath = jar.outputs.files + project.configurations.runtime } +// Force windows script classpath to wildcard path to avoid the 'Command Line Is Too Long' issues +// with generated scripts. Include Jolokia .war explicitly as this isn't picked up by wildcard +tasks.withType(CreateStartScripts) +{ + doLast { + windowsScript.text = windowsScript + .readLines() + .collect { line -> line.replaceAll(~/^set CLASSPATH=.*$/, 'set CLASSPATH=%APP_HOME%/lib/*;%APP_HOME%/lib/jolokia-agent-war-'+project.ext.jolokia_version+'.war') } + .join('\r\n') + } +} + // These lines tell gradle to run the Quasar suspendables scanner to look for unannotated super methods // that have @Suspendable sub implementations. These tend to cause NPEs and are not caught by the verifier // NOTE: need to make sure the output isn't on the classpath or every other run it generates empty results, so