'Strange error running a simple groovy script using Micronaut DI and Vertx

I have a project which is using Vertx and Micronaut DI

however something in this process breaks a simple capability in groovy of coercing a map to an interface

I have created a simple script like this. The same script in a simple groovy only project works just fine.

Has anyone else seen anything like this and what if anything needs to be fixed. I don't understand the error as the script itself isn't using DI or Vertx. I am assuming its something going wrong with Micronaut pre processors ?

package ioc

def map
map = [
        i: 10,
        hasNext: { map.i > 0 },
        next: { map.i-- },
]
def iter = map as Iterator
iter.each {println it}

Which when i run it generates the following error.

Caught: java.lang.NoClassDefFoundError: io/vertx/codegen/annotations/DataObject
java.lang.NoClassDefFoundError: io/vertx/codegen/annotations/DataObject
    at io.vertx.lang.groovy.VertxExtensionModule.asType(VertxExtensionModule.java:32)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at ioc.coerce.run(coerce.groovy:9)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Caused by: java.lang.ClassNotFoundException: io.vertx.codegen.annotations.DataObject
    ... 8 more

Process finished with exit code 1

Has any one seen anything like this and were able to fix it? Its a bit weird by itself.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source