This is related to . I'm trying to dynamically add the maven-ant-tasks jars with Grape, simulating this:
<taskdef uri="antlib:org.apache.maven.artifact.ant"
resource="org/apache/maven/artifact/ant/antlib.xml"
classpathref="ant.classpath" />
I've tried to use Grape.grab() to make maven-ant-tasks available to An...
Is there a way to have a custom taglib operate on data loaded in a .gsp file such that it picks up any tags embedded in the data stored in the database. For instance, let's say I'm doing:
<g:each in="${activities}">
<li>${it.payload}</li>
</g:each>
And inside the payload, which is coming from the database, is text...
I'm just about to write my first application in a duck typed language (Groovy).
If I was to write the same application in a static typed language then I would need to define some interfaces. Obviously because of the duck typing in Groovy they are not actually required. At the moment I am thinking that it might make sense to define them ...
Hi I'm trying to write groovy script to test written program.
I have to call this method:
public void gruss (Object newAge) {
super.grussInsert(newAge)
}
and print output to console, any advise how to do it, or where to start?
...
I'm using groovy gsql to query to Mysql database.
Everything goes well on localhost (testing mode), unfortunately when I switching to remote db groovy don't query db.
Here is the code :
def sqlModule = Sql.newInstance("jdbc:mysql://localhost/module-test", "b", "b", "com.mysql.jdbc.Driver")
def sampleQuery(int dataset) {
def Sampl...
What's the best way to create a gradle task, which runs a groovy script? I realize that gradle build files are groovy, so I would think it would be possible to do something like this:
task run << {
Script app = new GroovyShell().parse(new File("examples/foo.groovy"))
// or replace .parse() w/ a .evalulate()?
app.run()
}
I...
I'm new to Grails.
I'm trying to experiement with my grails domains from the shell, and I can't get it to work. These domains work fine from the scaffold code when I run the app.
Given this domain class
class IncomingCall {
String caller_id
Date call_time
int call_length
static constraints = {
}
}
I try to cre...
Code inside closures can refer to it variable.
8.times { println it }
or
def mywith(Closure closure) {
closure()
}
mywith { println it }
With this behavior in mind you can't expect following code to print 0011
2.times {
println it
mywith {
println it
}
}
And instead I have to write
2.times { i ->
printl...
Can we write instrumentation test cases for an android application in Groovy?
If so , how ?
...
Is there are easy way of parsing the whole HTML page and extract a specific section from the code of that page? i.e. i got this URL from the RSS feed of this site: http://www.groundreport.com/Sports/Bret-Hart-says-Farewell-to-WWE_4/2918823
What i want to do is parse that link and retrieve related images, tags, and other info from that p...
I'm trying to intercept a method call (afterInsert() of a domain class) in a Grails application. In doWithDynamicMethods closure of my plugin I have:
for (dc in application.domainClasses) {
// What I'm basically doing is renaming method A to B
// and creating a new method A with its own business logic
// and a call to B() at...
Hi,
I'm creating a grails app over a legacy database.
There is a table out of which I would like to create several different domain objects (Type1, Type2 and Type3 in my example below).
The table is like this :
ID TYPE DESCRIPTION
1 type1 description of a type1 object
2 type1 description of another type1 object
3 t...
Hi i am new to grails , i want to create connection to host like(http://ed.yeditepe.edu.tr) with some parameters taken from user(username and password) and then send this parameters with post connection to that host(ed.yeditepe.edu.tr) and make user login to system , any code sample or document for that (by the way user browser must be i...
I have several categories that I use in my Grails plugin. e.g.,
class Foo {
static foo(ClassA a,Object someArg) { ... }
static bar(ClassB b,Object... someArgs) { ... }
}
I'm looking for the best way to add these methods to the meta-classes so that I don't have to use the category classes and can just invoke them as instance me...
This works perfectly if the priobann list is populated:
banns << priobann?.pop()
However, if it's empty, I get the exception: java.util.NoSuchElementException: Cannot pop() an empty List
Shouldn't the question mark after priobann avoid this exception ?
...
For an application build on Spring MVC + Groovy + Google App Engine i need simple XML serializer/marchaller.
I'v tried:
XStream - it doesn't work on Google App Engine, because it uses restricted (at GAE) classes
Jaxb2 - it doesn't work with Groovy classes, because groovy class have additional (hidden) fields (like metaClass, etc)
Xml...
If I have a string in Groovy like so...
'user.company.name'
... and I want to get the the word "company" and "name" from that string, what is the best way to go about it?
I was thinking of something like this, but I'm not sure if it's the most efficient/groovy way:
def items = 'user.company.name'.tokenize('.')
def company = items[-2...
I have created a custom tag that looks like this:
def textField = { attrs ->
def field = attrs.name.split('\\.')[-1]
log.error("--------- Field is ${field}")
if (attrs.bean && attrs.bean.errors.hasFieldErrors(field)) {
def className = attrs.remove('class')
def classStr = 'errors '
if (className) {
...
I'm running Groovy Version: 1.7.0 JVM: 1.6.0_17
(Update -- I just upgraded to 1.7.1 and get the same errors!)
I've tried to use enums, using the exact syntax from the groovy documentation, and each time I see the compile error:
Groovy:The class java.lang.Enum refers to the class java.lang.Enum and uses 1 parameters, but the referred c...
I am working on a project using Groovy, and I would like to take an array of employees, so that no manager follows their subordinates in the array. The reason being that I need to add people to a database and I would prefer not to do it in two passes.
So, I basically have:
<employees>
<employee>
<employeeid>12</employeeid>
...