The surefire plugin is a special case; it runs the tests in a separate JVM. Most maven plugins don't do this, they run in-process.
So you are out of luck with that plugin config.
One workaround you can try is to use the exec:exec
goal of the exec-maven-plugin instead, specifying java
with -Djava.library.path
on the executable line and roll your own SQL-executing java code.
Otherwise, you can add -Djava.library.path
to your MAVEN_OPTS
environment variable, which will affect all plugins and all maven builds (which might be fine, depends on your setup), or add it every time to the mvn
command line.