XmlTemplateEngine - output format

2016-03-08 Thread Reinhard Torsten
Hi, I´m using the XmlTemplateEngine to generate some config files using the following code: XmlTemplateEngine engine = new XmlTemplateEngine() Template template = engine.createTemplate( getTemplateFile() ) Writable output = template.make( getConfig() ) StringWriter writer = new StringWriter()

Re: Failing to change the value of a Java variable from wihtin a Groovy script (potential issue?)

2016-03-08 Thread Dinko Srkoč
On 8 March 2016 at 18:11, Thierry Hanser wrote: > > Thank you Jason, you were indeed right, without CompileStatic or using > TypeChecked works. Well, it works, but probably not the way you think it works. Here's what you can do to get more insight into what's going on: * print the script's var

Re: building a jar from groovy script with gradle

2016-03-08 Thread Henrik Martin
That's good to know! I've only used the bootRepackage stuff for Spring Boot apps, so I've never really examined the bare dependencies of the uber jar without other Spring dependencies. The Spring Boot stuff in general is very nice, and I use it for everything from small IoT projects to Big Data

RE: Failing to change the value of a Java variable from wihtin a Groovy script (potential issue?)

2016-03-08 Thread Thierry Hanser
Thank you Jason, you were indeed right, without CompileStatic or using TypeChecked works. This is concerning as I would prefer static compilation (type checking being a must). I can work around the issue in my context but it impacts the elegance of the underlying DSL. However from the Groovy s

Re: building a jar from groovy script with gradle

2016-03-08 Thread David Dawson
good steer on shadowJar. I can confirm though that all you end up with is a couple of hundred kb of spring boot launcher. Nothing else spring is pulled in. On 8 March 2016 at 17:03, Henrik Martin wrote: > For "uber jars", I use both Spring Boot's bootRepackage, and shadowJar, > the Gradle port

Re: building a jar from groovy script with gradle

2016-03-08 Thread Henrik Martin
For "uber jars", I use both Spring Boot's bootRepackage, and shadowJar, the Gradle port of Maven Shadow. Both work really well and are easy to use from Gradle. The only thing about using Spring Boot is that you probably end up with a bunch of transient dependencies for Spring/Spring Boot that m

RE: Failing to change the value of a Java variable from wihtin a Groovy script (potential issue?)

2016-03-08 Thread Winnebeck, Jason
Unfortunately static compile can be pretty flaky at times and I run into bugs often with it and have to redesign code. For small scripts I would advise against it (if you need type checking, use TypeChecked). I'm wondering if the script is getting compiled to get field x from the base class but

Failing to change the value of a Java variable from wihtin a Groovy script (potential issue?)

2016-03-08 Thread Thierry Hanser
Hi, The following very simple code is behaving really strangely. Could anyone please tell me if this is an issue in Groovy or something I am not doing properly (I would like to vote for the latter, yet...). In Java x='one'; System.out.println("init x: " + x); In Groovy println '1 = ' + x x =

Re: building a jar from groovy script with gradle

2016-03-08 Thread David Dawson
I actually re-use the spring boot plugin. You don't have to use it to build a spring boot application, it can build vanilla apps too. add the spring boot plugin, set the mainClass attribute as in their examples and do a gradle bootRepackage. You'll end up with a single runnable jar file. You ca

Re: building a jar from groovy script with gradle

2016-03-08 Thread Schalk Cronjé
What's wrong with running a .bat file? On 08/03/2016 14:30, Gerald Wiltse wrote: I have a similar situation I am about to tackle, building an installer that executes Groovy code. This will be going to clients and run on windows, so it really has to be an EXE. Anybody have good experience with

Re: building a jar from groovy script with gradle

2016-03-08 Thread Gerald Wiltse
I have a similar situation I am about to tackle, building an installer that executes Groovy code. This will be going to clients and run on windows, so it really has to be an EXE. Anybody have good experience with JAR-to-EXE packers or something? Gerald R. Wiltse jerrywil...@gmail.com On Tue, Ma

RE: building a jar from groovy script with gradle

2016-03-08 Thread Winnebeck, Jason
I've "deployed" some scripts to other users in my organization where Java but not Groovy is installed through the GroovyWrapper script. I got it from Codehaus and I can't find the original copy anywhere but I found a fork of it at https://github.com/sdanzan/groovy-wrapper that appears to have mo

Re: building a jar from groovy script with gradle

2016-03-08 Thread Jim Northrop
Out of interest, what is the typical deployment strategy for a runnable Groovy class w/main method? I have been trying to make a user executable jar but as 2 diff.jars. One jar is only my code, no support jars and 2nd is mystuff-all-v1.0.jar as a bundle w/all dependency jars included hence runna

Re: building a jar from groovy script with gradle

2016-03-08 Thread Schalk Cronjé
In that case I would suggest laying your project out as a minimal Groovy project rootDir -- src -- main -- groovy - yourpackage -- MyClass.groovy, HelperClass.groovy and make your build.gradle to be like apply plugin : 'groovy' apply plugin : 'application' mainClassName='MyClass'

Re: building a jar from groovy script with gradle

2016-03-08 Thread Raphael Bauduin
I have a groovy class with a main that has to be run, another help class in Groovy, and a bunch of jars needed by the app in ~/.groovy/lib/. I got it working by using these lines (replacing what I had in the initial config): from configurations.runtime.asFileTree.files.collect { zipTree(it).

Re: building a jar from groovy script with gradle

2016-03-08 Thread Schalk Cronjé
I can spot a number of issues in your Gradle script, howver I need to understand context. [1] Are you trying to put a single Groovy script + required Groovy JARs into a JAR? OR [2] Are you trying to build a proper Groovy application consisting of a coouple of class files en dependent JARs?

building a jar from groovy script with gradle

2016-03-08 Thread Raphael Bauduin
Hi, I'm trying to package a groovy script as a jar with the help of gradle, I use this gradle config: http://pastebin.com/RFEhzMCp it builds fine, but when I try to run it with java -jar path_to.jar I get this error: Error: A JNI error has occurred, please check your installation and try again Ex