Hi,
I would like to execute foo.bat from within a Groovy program and have the resulting process' output redirected to stdout. Either a Java or Groovy code example would be fine.
foo.bat can take several minutes to run and generates a lot of output, so I would like to see the output as soon as it is generated, rather than having to wait...
This is about a very basic program I'm writing in Groovy.
I have defined a map inside a method:
def addItem()
{
print("Enter the item name: ")
def itemName = reader.readLine()
print("Enter price : ")
def price = reader.readLine()
print("Enter barcode : ")
def barcode = reader.readLine()
data[itemName] =...
Hey People of Groovy,
I am looking for a way to modify/change an existing closure. However, I do not wish to overwrite it; instead I would like to enhance it.
Here is a quick example. Let's say we have an Address object:
class Address {
String street
String city
String state
String zipCode
static constraints = {
...
I'd like to port a little piece of code from Ruby to Groovy, and I'm stuck at this:
def given(array,closure) {
closure.delegate = array
closure()
}
given([1,2,3,4]) {
findAll { it > 4}
}
Right now it dies with this message:
Exception thrown: Cannot compare ConsoleScript0$_run_closure1 with value 'ConsoleScript0$_run_closu...
Hi!
I am developing a groovy application and I am having problems when showing a Date field.
If I use the following notation:
<g:formatDate format="dd.MM.yyyy" date="${fieldValue(bean: incidentTicketSLAInstance, field: "erstellungsDatum")}"/>
I am getting the actual date instead of what is saved at the DB.
When I use this notation i...
In Grails, there are two mechanisms for modularity in the view layers : template and taglib.
While I am writing my own Grail app, I am often facing the same question when I need to write an UI component : do I need to use a template or a tagLib ?After searching the web, I didn't find a lot of best practices or rules of thumb concerning ...
I typically use groovy to construct simple bean but the Spring IDE plugin to eclipse fails to build when I try to set a property that is generated by groovy without an explicit setter. For example,
class MyGrooyClass {
def propertyA
}
and in the spring configuration file I have something that looks like:
<bean id="MyGroovyClassBe...
Removing an element from a list isn't working, which doesn't make any sense. Am I missing some special semantics peculiar to dealing with a Grails domain object list?
In controller:
def userCreate = {
def workgroupInstance = new Workgroup()
workgroupInstance.manager = authUserDomain
flash.message = User.list().toString()
...
The IntelliJ Groovy/Grails support in IntelliJ IDEA 8.1 is great.
However, I've recently upgraded to the new and recently open-sourced IntelliJ IDEA Community Edition 9.0 BETA. Since updating to the new version the Grails support seems to have disappeared. I'm no longer able to choose the option "Grails application" when creating a new...
Hi, I'm trying to make some components inside a JSrollPane unresizable, because content inside can grow dynamically and I must prevent it from growing over a predefined size.
My approach so far is this one:
scrollPane(constraints:BL.CENTER, size:[500,200], maximumSize:[500,200]){
panel(background:Color.WHITE, border:BF.createTitled...
I'm trying to use 'bindData' method and exclude one field like so:
bindData(person, params, [exclude: ['responseItems']]);
I thought that by listing the 'exclude' parameter, when bindData iterates over 'params', it would ignore the key-value pair specified in the array but it doesn't appear so.
Instead, I'm getting an error:
org....
Groovy offers some really neat language features for dealing with and implementing Java interfaces, but I seem kind of stuck.
I want to dynamically implement an Interface on a Groovy class and intercept all method calls on that interface using GroovyInterceptable.invokeMethod. Here what I tried so far:
public interface TestInterface
{
...
I'm new to Grails/Groovy and am trying to find a node in a an xml file; I've figured out how to iterate over all of them, but I want to exit the loop when the target node is found. I've read that instead of using "each", use "find", but the find examples I've seen are conditions. Right now the logic I have is going to iterate through the...
Defined routes:
from("direct:friends").process({exchange -> exchange.'out'.body = exchange.'in'.body.profile} as Processor).splitter(body(List), true).to("activemq:profiles")
from("direct:profiles").process({exchange -> exchange.'out'.body = exchange.'in'.body.friends} as Processor).to("activemq:profiles")
Fails with some: jav...
(Specifically, org.codehaus.groovy.util.AbstractConcurrentMap)
While doing some profiling of our application thats mixed Java/Groovy, I'm seeing a lot of references to the AbstractConcurrentMap class, none of which are explicit in the code base. Does groovy use this class when maps are instantiated in the groovy dynamic def myMap = [:]...
I recently found an example on implementing a We3bService with groovy and jax-ws:
the problem is that the @webmethod annotation seems to be ignored.
This is the source code of the groovy script:
import javax.jws.soap.*
import javax.jws.*
import javax.xml.ws.*
import javax.xml.bind.annotation.*
@XmlAccessorType(XmlAccessType.FIELD)
cla...
What kind of Applications are suited
mostly for Ruby or Groovy ?
Alternatively
what problems are better addressed by
programming languages like Ruby or
Groovy ?
...
I've built a custom builder in Groovy by extending BuilderSupport. It works well when configured like nearly every builder code sample out there:
def builder = new MyBuilder()
builder.foo {
"Some Entry" (property1:value1, property2: value2)
}
This, of course, works perfectly. The problem is that I don't want the information I'm bu...
Hi ,
I'm trying to read the incoming request & set the mock response depending on a value comming in the request in soapUI 3.0. I use the following groovy script for this.
def typeElement = mockRequest.getContentElement().execQuery("//ProductType");
def records = new XmlParser().parseText(typeElement[0].xmlText())
if (records.text()==...
I know I can annotate my classes in Groovy with annotations, but can I write the annotation itself in Groovy (as opposed to just using annotation written in Java)? If so, from what version?
...