groovy

Can Grails output error messages in emacs format?

Ant has a -e option for outputting error messages that can be parsed by emacs' compile command. For example, it is possible to do M-x compile, ant -e, then nagivate to any errors with C-x `. Is it possible to make grails output its compilation errors in this format? Alternatively, is there an emacs variable that can be customized to h...

Groovy Eclipse Autoformat?

Using Eclipse 3.6 and Groovy 2.0.1.20100319-1100-e35-RELEASE, auto-format does nothing. That is, for a given groovy file, Source > Format does nothing. Any thoughts? ...

invoking groovy without passing a classpath each time

In a windows environemnt, how can I invoke groovy without having to specifiy the classpath for a given set of JARs each time? I am trying to create a script for an admin so that he can just type groovy deploy [project name]. Edit: Is there anyway to do this through a class path environment variable? Or some other centralized configurati...

Grails console - Unable to find class?

I'm working through the "Grails in Action" book, and I'm stuck at that part that introduces the grails console. From my project directory, I typed "grails console" to open a console window, and the console even output information indicating it was compiling classes, but when I type this into the console: new Quote(author:'Larry Wall',co...

GSP rendering programatically

Suppose I have a gsp snippet stored in my database. How do I programatically merge it with a data model to produce a string. ...

Managing Java dependencies in a Grails application?

I'm trying to adopt my development from Spring/Maven2/Tomcat -> Grails, and I'm wondering if there's an easy way to manage dependencies in grails separate from maven. Maven does a lot of the magic that grails is doing automatically (unit testing/building/etc.), so I wonder if there's a need for maven at all in grails projects. So, then,...

Multiple file access in groovy(Groovy on Grails)

Hello, I have an application that allows multiple users to access 1 xml file. The problem is that when all the users save at once the other changes by other users does not get saved. How do I detect if the file is in user in groovy? Thanks! ...

cannot import groovyx.net.ws.WSClient from either groovysh or groovyConsole

hi i tried import groovyx.net.ws.WSClient from both groovysh or groovyConsole, adn netbeans ... it just says "cannot resolve class groovyx.net.ws.WSClient" any body gives me an hint? thanks! ...

Anonymous code blocks in Groovy

Is there a way to use anonymous code blocks in Groovy? For example, I'm trying to translate the following Java code into Groovy: { int i = 0; System.out.println(i); } int i = 10; System.out.println(i); The closest translation I can come up with is the following: boolean groovyIsLame = true if (groovyIsLame) { int i = 0 printl...

Grails JSON array

I'm converting a list of Foo objects to a JSON string. I need to parse the JSON string back into a list of Foos. However in the following example, parsing gives me a list of JSONObjects instead of Foos. Example List list = [new Foo("first"), new Foo("second")] def jsonString = (list as JSON).toString() List parsedList = JSON.parse(jso...

How do I pass values from grails back to a javascript function?

Hi, I have a feeling that the answer to this is easy but I can't seem to get it yet... I have a Javascript function that calls an action in a Groovy class via a remoteFunction. Now, I need to return the value from the action class back to the Javascript function for further processing. It looks something like this: // sample js functi...

Groovy and GWT: Combining both paradigms

Hi Is it possible to develop an application in groovy using GWT components? Luis ...

groovy&grails and extjs with netbeans and autocomplete for extjs possible?

Hi everyone! I am using groovy and grails with netbeans. Is there a way to use autocomplete in ExtJS ?(with the .js files in webapp) I read, that netbeans supports autocomplete with ExtJS, however it's not working in my project ... I am using Netbeans 6.8 greets ...

Grails - Need to restrict fetched rows based on condition on join table

Hi guys, I have these two domains Car and Driver which have many-to-many relationship. This association is defined in table tblCarsDrivers which has, not surprisingly, primary keys of both the tables BUT additionally also has another boolean field deleted. Herein lies the problem. When I find/get query on domain Car, I am fetched all re...

Using (multi lexeme) grails targets in gant scripts

I have a gant script in my grails project. I would like to do something just like this: includeTargets << new File ( "${grailsHome}/scripts/War.groovy" ) war() But for the deploy target in the script provided by the tomcat plugin. Specifically, I would like to invoke this target: grails prod tomcat deploy how would that happen? ...

Cannot set g:checkbox to off for a child on one-to-many relationship

Got a weird issue with g:checkbox not being saved when its switched from on to off for a child in one-to-many relationship. For example: class Parent { Boolean enabled static hasMany = [children: Child] static constraints = { enabled(blank: true, nullable: true) } } class Child { Boolean enabled static belongsTo = [pare...

In Grails, How can I create a domain model to link two of another model?

Hey all, I'm currently trying to create a Friendship domain object to link two User objects (with a bit of additional data: createDate, confirmedStatus). My domain model looks as follows class Friendship { User userOne User userTwo Boolean confirmed Date createDate Date lastModifiedDate static belongsTo = [userOne:User , userTwo:User...

Compiling a groovy template to a class file i tomcats work dir

I just installed tomcat (6.0.20) with groovy-all.jar (1.7.2) in my WEB-INF/lib My web.xml file looks like this <web-app> <servlet> <servlet-name>Groovlet</servlet-name> <servlet-class>groovy.servlet.GroovyServlet</servlet-class> </servlet> <servlet> <servlet-name>Template</servlet-name> <ser...

A better way to do XML in Java

There are a lot of questions that ask the best XML parser, I am more interested in what is the XML parser that is the most like Groovy for Java? I want: SomeApiDefinedObject o = parseXml( xml ); for( SomeApiDefinedObject it : o.getChildren() ) { System.out.println( it.getAttributes() ); } The most important things are that I don't...

How to mask input in groovy

How can I mask input from the command line? Basic use case: I want to enter a password when prompted, and I need to either see *'s or nothing at all. ...