Question

I'd like to be able to append a lib directory to the system path to allow Maven to run unit tests that (gah) use DLL native libraries.

I have so far used <argLine>-Djava.library.path=${path.dll}</argLine> to add my DLL path as a library path. However, Windows still wants to resolve DLLs via the path, and I'm getting:

java.lang.UnsatisfiedLinkError

So, is there a way of providing a modified system path to Surefire?

Thanks in advance for your help.

Was it helpful?

Solution

Turns out the following config was necessary:

<plugin> 
  <groupId>org.apache.maven.plugins</groupId> 
  <artifactId>maven-surefire-plugin</artifactId> 
  <configuration> 
    ...
    <environmentVariables> 
      <PATH>${basedir}\..;${java.library.path}</PATH> 
    </environmentVariables> 
    ...
  </configuration> 
</plugin> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top