Maven plugin java.library.path

java.library.path, maven, maven-plugin, sql-maven-plugin

Solution

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.

Problem

The maven-surefire-plugin supports using the `java.library.path` property by means of the `<argLine>` configuration option. I need to pass the `java.library.path` property to sql-maven-plugin (which doesn't have an `<argLine>` configuration option) in order to use the jTDS driver with windows authentication (needs ntlmauth.dll). Thanks in advance for your help.

Original source