Classpath issue with groovy-all and APE scriptable datasets



Hi guys,

I’m working on this APE issue and need an advice on how to add groovy-all to enable groovy script in datasets.

To make it work I had to add groovy all to test deployment:

public static Archive<?> createDeploymentPackage() {
    WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
            .addPackages(true, "org.assertj.core")
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsResource("test-persistence.xml", "META-INF/persistence.xml");
    MavenResolverSystem resolver = Maven.resolver();

    return war;

But what I would like is to add it automatically when scriptableDatasets property is enabled in arq.xml.

The it-test can be found here. I’ve commented the lines which adds groovy to micro deployment so you can reproduce the issue. When the test is run, the following warnning is logged on server:

07:39:49,385 WARNING [] (default task-24) Could not find script engine with name groovy in classpath

It happens when we try to get groovy script engine here.

I’ve tried to work on DBUnitArchiveAppender but without success, here is how I’m trying to add it:

    dbUnitExtensionArchive.addPackages(true, new String[]{
    dbUnitExtensionArchive.addAsResource("META-INF/services/javax.script.ScriptEngineFactory", ArchivePaths.create("META-INF/services/javax.script.ScriptEngineFactory"));
    dbUnitExtensionArchive.addAsResource("META-INF/services/org.codehaus.groovy.runtime.ExtensionModule", ArchivePaths.create("META-INF/services/org.codehaus.groovy.runtime.ExtensionModule"));
    dbUnitExtensionArchive.addAsResource("META-INF/services/org.codehaus.groovy.plugins.Runners", ArchivePaths.create("META-INF/services/org.codehaus.groovy.plugins.Runners"));
    dbUnitExtensionArchive.addAsResource("META-INF/services/org.codehaus.groovy.transform.ASTTransformation", ArchivePaths.create("META-INF/services/org.codehaus.groovy.transform.ASTTransformation"));
    dbUnitExtensionArchive.addAsResource("META-INF/services/org.codehaus.groovy.source.Extensions", ArchivePaths.create("META-INF/services/org.codehaus.groovy.source.Extensions"));


You can download generated arquilian-persistence-dbunit.jar here.

Any idea on how to solve that?


Looks like its a nasty classloading issue:

I also tried to create groovy-all.jar separated from arquillian-dbunit.jar (separated appender) but also didnt worked.


I’m on holidays now, back 22.05. Can’t help with the actual code, but some hints from the top of my head.

Check how we deal with groovy in Spock test runner. There were certain problem, but eventually we made it working.


Now it just works :wink: thank you again @bartoszmajsak!