I'm eager to use the @GrailsCompileStatic annotation in many places of my grails 3.1.7 application. But the main problem is that it doesn't take into account that domains, commands and controllers are 'mixed' with additional methods (like save() or v
I'm attempting to delete the build history from Jenkins using the instructions in this answer: How do I clear my Jenkins/Hudson build history? However, I'm getting the following error message: groovy.lang.MissingMethodException: No signature of metho
I am currently in the process of attempting to update an ElasticSearch document via the Java API. I have a groovy script with the following code: static updateRequestById(String agencyIndex, String type, String id, def policy) { UpdateRequest updateR
I have a project with multiple groovy files, and I have several "tiny" classes that I want to put in a single file. Basically, here is what I want: Foo.groovy: class Foo { Foo() { println "Foo" } } Bar.groovy: class Bar { Bar() { print
I'm newbie to Groovy and I have a very simple question. I know how to add a single element to an existing list in Java, but I guess there is a quicker way to do it in Groovy, but I don't know how ... Supposing that I have a domain object Obj1, that t
My Grails app is using version 2.3.6 In this app there's a Controller class: class UserOrderController { def index(Integer max) { params.max = Math.min(max ?: 20, 100) respond UserOrder.list(params), model:[userOrderInstanceCount: WorkOrder.count()]
Can anyone please help me.I have two domains. Class Parent{ static hasMany = [child: Child]; } Class Child{ } In database there are 20 records.I want to get 10 records only without refreshing the page.So i used remote pagination like. gsp code is <ut
How can I implement Groovy's new traits in my Grails Spock tests? Every time I try, I get a stacktrace that looks like this. Is there some limitation of Groovy trails that I might not be aware of? JDK Version: java version "1.7.0_65" OpenJDK Run
def "validate my files list"() { when: new File(folder).eachFileRecurse { validateFile(it) } then: notThrown(ValidationFailedException) where: folder << ['folder1', 'folder2'] } I have coded that simple test with Spock and Groovy. When it
I'm pretty new to testing and SoapUI and I've just faced a problem: I have 2 soap requests from which I transfer data (using PropertyTransfer) to Properties - I can do that and it works fine for me. But now I would like to take those values in my gro
I'm currently trying to parse a node in groovy which contains mixed text and nodes with text and I need to get the text in the right order for example: <?xml version="1.0" encoding="UTF-8"?> <root> <p> The text has &l
I am writing a test that requires me to execute a java file at one point. The Java file is already compiled and I do not have access to the source code or documentation. I know if I open up a command prompt and execute the file via typing: "java -jar
I am using Datable 1.10 server side processing with Grails. New version of Datatable changed the ajax post request format. I am parsing params values like this. its giving the error. println params?.start println params?.columns[1]?.search?.regex in
I'm trying to convert a timestamp to a date with format DD/MM/YYYY using Groovy To do this, I initially get a Timestamp value returned from a database query. It has the format: YYYY-MM-DD HH:MM:SS.S (the .S is actually a milisecond I guess) So I crea
I'm coming from the PHP world and I need to do do some tallying of records. In php I know this is simple, but how do I do the following in Groovy $logs = array( array( 'date' => '5-15', 'name' => 'foo' ...other stuff), array( 'date' => '5-15', 'n
Getting grailsApplication as null when running spock test cases using UnitSpec for service class in Grails application. Error - Cannot get property 'config' on null object Can anybody tell me how to configure grailsApplication while spock testing ser
I am not sure whether this is the right forum to ask this question, but it refers to code, so I am asking here. In the book "Groovy in action", section 7.1.4 (named parameters), the author says that usage of named params "crops up frequentl
I am using opencsv in my Grails application to export attributes from my Person domain class to CSV. I am receiving the following error, however: Servlet.service() for servlet [default] in context with path [/myapp] threw exception [Request processin
To create a web application on Google's AppEngine I was looking for a framework. During my research I came across Groovy and Grails. I'm a Java kind of guy so I prefer something Java-like above Python frameworks (like Django). So I scraped together s
I have a Training domain class class Training { String type Date createdOn Date modifiedOn static belongsTo = [course: Course] static hasMany = [attachments: Attachment] } and i have Course domain class class Course { String name static hasMany = [tr
After running into this question today: Grails query not using GORM I wonder if using groovy.sql.Sql or JDBC comes with the benefits of connection pooling? I can see under some circumstances how going GORMless could be beneficial, but lack of conn po
I've been recently playing with Groovy and have messed around with JRuby before and appreciate using the .each{} closure in their collections. That said, I cannot help but feel that this is nothing but syntactic sugar for a visitor pattern. If you en
static void main(args){ System.in.withReader { def input = it.readLine() for(def i = 0; i < input; i++){ println i } } } The source code..simple one I guess but dont know why it is printing till 48..here is the output if the argument supplied is 1. 0
I am using this line here to sort a list based on the object's name. g.V.sort{it.name} How do I sort it based on "name" if it exists, if not, I wanna sort it by "title". If both exist I want to first sort by "name" and then b
Take the following controller: package test class TestController { static defaultAction = "test" def test() { render "test" } } Why is test defined with def test() { instead of something like void test() {? Isn't the def keyword only u
Groovy scripts are placed in a Database entry (data type BLOB). I can read the bytes and convert to a String object. How can I use GroovyClassLoader or GroovyScriptEngine to compile and execute the script? I need to track dependencies between scripts
I always seem to be needing to cast values in the params object in order to perform a .equals but it never feels right. If i use the parseXXX methods I also have to protect myself when the value is empty. It seems like there would be a better way to
I want a code that will return a list like this : def list = ["RR","SS"] //code to get the output as [R,R,S,S] I came up with idea like this: def Ash = ["RR","as","RTY"] def listA = [] for(i=0;i<Ash.siz
I tried to run the groovy script. But unfortunately the script does not ask me for the input and through null pointer exceptions. Please help me what I need to do for this. static startShell() { client = new Client() // TODO add Windows compatibility
I am just starting out with Groovy. I couldn't find any examples anywhere of how to handle arguments to a Groovy script and so I hacked this method myself. There must be a better way of doing this? If so, I am looking for this better way, since I am