How to pass jvmArgs to DropwizardTestSupport

167 views
Skip to first unread message

Glen....@varian.com

unread,
Jul 13, 2018, 2:31:30 PM7/13/18
to dropwizard-dev
We are updating our project from Java 8 to Java 10, which uses DropwizardTestSupport to run cucumber tests. 

When running the tests it gives the error “java.lang.ClassNotFoundException: java.sql.Time”.

From what I can tell, the error is because cucumber has a dependency on Gson, which has a dependency on java.sql.Time:


I think we need to use the jvmArgs '--add-modules java.sql.Time', but I don't know how to pass this to DropwizardTestSupport.

Or is there another way this should be fixed?

Jochen Schalanda

unread,
Jul 15, 2018, 6:45:39 AM7/15/18
to dropwiz...@googlegroups.com
Hi Glen,

you can add JVM parameters via the "argLine" configuration setting in the Maven Surefire plugin.


Cheers,
Jochen

--
You received this message because you are subscribed to the Google Groups "dropwizard-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Glen....@varian.com

unread,
Jul 16, 2018, 9:10:50 AM7/16/18
to dropwizard-dev
I should have mentioned we are using gradle. I have tried adding the jvmArgs to the test task in build.gradle:

apiTest {
    jvmArgs += ["--add-modules", "java.sql.Time"]
}

We are instantiating DropwizardTestSupport in Java code, I assumed this is where we would need to somehow tell it about the module dependency:

DropwizardTestSupport<Configuration> dropwizardTestSupport = new DropwizardTestSupport<>(ApplicationRunner.class,getConfigurationFile());
dropwizardTestSupport.before();

Glen....@varian.com

unread,
Jul 27, 2018, 11:23:41 AM7/27/18
to dropwizard-dev
We were able to resolve this by changing the following in build.gradle:

apiTest {
    systemProperties
= System.properties
}

to the following:

apiTest {
    systemProperties
= System.properties.findAll {
        p
-> !p.key.toString().startsWith("java.vm")
   
}
}


Also, the error I posted initially was only appearing when running from IntelliJ (a separate issue). The gradle task was failing with a different (more obscure) error.
Reply all
Reply to author
Forward
0 new messages