kazuken | 1 Oct 02:39 2014

[groovy-user] htmlunit with maven

Wondering how to solve dependency issues. I am using IntelliJ with the simple
maven archetype for Groovy. I have tried both selenium and htmlunit. On
htmlunit 2.15:

Caught: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal

I have added xml-apis to the exclusion list. htmlunit 2.10 or 2.9 doesn't
seem to give this error. If I don't exclude I will get a classloader error.
My thoughts are the dependencies are of later version than what Groovy has? 

from this page: http://groovy.codehaus.org/Testing+Web+Applications
"Note that to use HtmlUnit with Groovy you should not include the
xml-apis-*.jar included with HtmlUnit in your CLASSPATH."

Is there a list of other libraries not to include? I'd really like to figure
this out. Maven provides great packaging features into a uberjar. Otherwise
I think groovy works fine with grapes.

View this message in context: http://groovy.329449.n5.nabble.com/htmlunit-with-maven-tp5721374.html
Sent from the groovy - user mailing list archive at Nabble.com.

To unsubscribe from this list, please visit:


Winnebeck, Jason | 30 Sep 16:37 2014

[groovy-user] java.lang.NoClassDefFoundError: void with ternary ?:

I get a weird error on code that works perfectly on one machine but fails on another. This code is in a class
marked  <at> CompileStatic, and Groovy 2.3.6 is in use:

Object emulateUser(Map<String, Object> user) throws ForbiddenException, InvalidRequestException {
	def username = user?.username as String
	username ? userInfo.emulateUser(username) : userInfo.clearEmulation()
	return currentUser()

userInfo is a private field of a groovy class type (not an interface). Both methods return void.

The error I get is: java.lang.NoClassDefFoundError: void on the line starting with username ?. The error
occurs AFTER successfully executing the userInfo methods (either case works).

I was curious to see if Groovy supports ternary ?: operator with void types. Maybe this is the cause of the
error? But it is odd that it runs on my machine (Windows JDK 1.7u51) but fails on another (Linux JDK 1.7u45).
In the first (working) case the code was compiled with IntelliJ IDEA (via opening the pom.xml directly),
the second with Maven via gmavenplus-plugin 1.2.


This email message and any attachments are for the sole use of the intended recipient(s). Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please
contact the sender by reply email and destroy all copies of the original message and any attachments.

To unsubscribe from this list, please visit:

(Continue reading)

vetko | 30 Sep 09:45 2014

[groovy-user] Can not really override equals with category class from java.lang.Number to a self-defined one

We have difficulties overriding 'equals' with a self-defined Category class
in case we want to introduce a new DSL that can test equality between
self-defined classes and numbers/strings. It works in one direction, but it
doesn't work when the accepting class ('this' class) is a specific(?) Java
class, like Number (Integer, BigDecimal) or String. Although it does work
for example on ArrayList in both directions.

Is there any explication behind this, and does thid work as designed?
Because we have a very important task depending on this and would be really
critical for us to work.

We are currently using Groovy 2.3.6 (non-indy).
Here is an example evaluable in any Groovy Console:

class EmptyClass {

class MyCategory {
    static boolean equals(EmptyClass ec, Number n) {
        return true;
    static boolean equals(Number n, EmptyClass ec) {
        return true;

def ec = new EmptyClass()

use(MyCategory) {
    println(ec == 5)
(Continue reading)

Andres Almiray | 30 Sep 03:07 2014

[groovy-user] [ANN] Griffon 2.0.0 Released!

The Griffon team is happy to announce the release of Griffon 2.0.0!

This is it, Griffon 2.0.0 is finally out!

The following list summarizes the changes brought by this release:

    Plugin dependencies were upgraded to their latest versions.

We look forward to your feedback. Please report any problems you find to the Griffon User list, or better yet, file a bug at http://github.com/griffon/griffon/issues

Remember you can also contact the team on Twitter: <at> theaviary.

Many thanks to all who contributed to this release!

The Griffon Team

Guillaume Laforge | 29 Sep 22:44 2014

[groovy-user] [ANN] Groovy Weekly #38

Hi all,

It's a bit early, although it's already Tuesday in Australia, but here's Groovy Weekly number 38!

Guillaume Laforge
Groovy Project Manager
Pivotal, Inc.

Martin d'Anjou | 29 Sep 20:55 2014

[groovy-user] javolution problems with groovy

The javolution library gives me errors with groovy 2.4.0-beta-3. The program is:

<at> Grapes([
  <at> Grab(group='org.javolution', module='javolution-core-java', version='6.0.0')

import javolution.io.Struct
import javolution.io.Struct.Unsigned8

class Header extends Struct {
  def data = new Unsigned8()
  void main() {
    println("Hello Javolution")

def h = new Header()

[DEBUG] javolution.context.LogContext#LEVEL=DEBUG
[DEBUG] javolution.io.Struct#MAXIMUM_ALIGNMENT=4
Caught: org.codehaus.groovy.runtime.metaclass.MethodSelectionException: Could not find which method <init>() to invoke from this list:
  public javolution.io.Struct$Unsigned8#<init>(javolution.io.Struct)
  public javolution.io.Struct$Unsigned8#<init>(javolution.io.Struct, int)
org.codehaus.groovy.runtime.metaclass.MethodSelectionException: Could not find which method <init>() to invoke from this list:
  public javolution.io.Struct$Unsigned8#<init>(javolution.io.Struct)
  public javolution.io.Struct$Unsigned8#<init>(javolution.io.Struct, int)
        at Header.<init>(s.groovy:14)
        at s.run(s.groovy:20)

Is this a groovy problem?

Pedja | 25 Sep 15:06 2014

[groovy-user] How to forbid certain classes from groovy's reach when executing it from java? (like sandbox)

Hi everybody,

I'm pretty new to groovy, and scripting in java generally, and I really
hope there is a simple solution for my problem.
In our application, the users can execute groovy scripts which they write
themselves, and we need to control what those scripts can and can not do.
I read a lot of stuff about sandboxing groovy, but either I am looking at
wrong places or I am overlooking the obvious.
To make it simple, I have a small example which demonstrates the problem.
This is my class loader which should prevent java.lang.System from being
loaded and available to scripts:

And this is a simple program that tries to call System.currentTimeMillis():

MyClassLoader throws exceptions for java.lang.SystemBeanInfo
and java.lang.SystemCustomizer, but the code executes.
Same thing happens if I use javax.script classes:

And if I try it with JavaScript engine, it works as expected (just replace
"Groovy" with "JavaScript" in the above example).

I just found in a similar thread, that if i execute this:

I will get groovy.lang.GroovyClassLoader and my.package.MyClassLoader,
respectively. So I guess GroovyClassLoader is loading the System class, I
just don't know if and how I can influence that.

Can anyone help me with this? BTW, I'm using groovy-all-1.8.8.jar, with


View this message in context: http://groovy.329449.n5.nabble.com/How-to-forbid-certain-classes-from-groovy-s-reach-when-executing-it-from-java-like-sandbox-tp5721352.html
Sent from the groovy - user mailing list archive at Nabble.com.

To unsubscribe from this list, please visit:


jiale.chan | 24 Sep 11:35 2014

[groovy-user] The case of the division operator

"The division operators / (and /= for division and assignment) produce a double result if either operand is a float or double, and a BigDecimal result otherwise (when both operands are any combination of an integral type short, char, byte, int, long, BigInteger or BigDecimal)."

It's come from groovy document but it's too hard to understand for people who's mother language is not english.

I would like to asking who can explain it in other word to make is easier to understand?
Jorge Franco | 24 Sep 09:11 2014

[groovy-user] Applying AST transformation for testing


In runtime, sometimes I load classes, after apply an AST with compiler customization.

withConfig(configuration) { ast(MyAst) }

I want to offer a way to test that classes in Spock or other test frameworks. I was thinking in offer an static method or AST, like Grails does:


<at> MockMyAst(ClassToTest)
class MyTest extends Specification {

But, I don't know the best way to implement that. Changing test classloader? Changing metaClass of target class? any way to capture classloading in spock?.... Do you have any tip or suggestion to implement it?

Thank you!

[groovy-user] Gpars.org ICANN or cannot

Sorry, if this is off topic. Has anyone in the know visited the gpars org site today. Seems they've run afoul of some ICANN compliance requirement. Probably failed to submit their DNA and retinal pattern to the GAC. Or retaliation for maximizing user cycles at the expense of state sponsored botnets. :)
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Pavel Alexeev | 23 Sep 19:40 2014

[groovy-user] <at> TupleConstructor together with <at> TupleConstructor


I'he try use two annotations but seams not fully understand logic. I
want copy constructors (one really) from parent, and generate others by
fields of class:

class Base{
    Base(Map map){
        println "Called Base(Map map)"

 <at> TupleConstructor(force=true)
 <at> InheritConstructors
class Person extends Base{
    def firstName
    def age

println Person.constructors

It give me output:
[public Person(java.util.Map), public Person(java.lang.Object), public
Person(java.lang.Object,java.lang.Object), public Person()]

But on instantiate of object:
Person p = new Person(['UserName', 33]);
got exception:
java.lang.NoSuchMethodError: Base: method <init>()V not found

What also looks reasonable (meantime note I call constructor with
Adding empty constructor like Base(){} also thrown error:
java.lang.ClassFormatError: Duplicate method name&signature in class
file Person
Indeed empty constructor already was generated as we seen early.

Is there way pick up what exactly constructor I would like to copy? Or
any other suggestions please.

With best wishes, Pavel Alexeev (aka Pahan-Hubbitus). For fast contact
with me use jabber: Hubbitus@...

To unsubscribe from this list, please visit: