I have a Maven dependency that requires a DLL at runtime. What I want to do is to simply have that dll in resources/lib
folder and place its DLLs to the target
directory. So what've I done is :
src/main/resources/lib
Modified pom.xml
to use argument -Djava.library.path=${basedir}/lib like so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>once</forkMode>
<workingDirectory>target</workingDirectory>
<argLine>-Djava.library.path=${basedir}/lib</argLine>
</configuration>
</plugin>
However I am still getting runtime error that DLL is not present in java.library.path.
Maven sure fire plugin is used to follow the sequence of tests in testng. xml file. If we don't include the Mavwen surefire plugin then it will execute all the testcases under src/test/java which has prefix or suffix as 'test' and these tests will get executed without any sequence.
The Surefire Report Plugin parses the generated TEST-*. xml files under ${basedir}/target/surefire-reports and renders them using DOXIA, which creates the web interface version of the test results.
Your <argLine/>
points to an incorrect path. Try this instead:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>once</forkMode>
<workingDirectory>target</workingDirectory>
<argLine>-Djava.library.path=${basedir}/src/main/resources/lib</argLine>
</configuration>
</plugin>
If this DLL will only be used for tests, you should put it under src/test/resources
. In that case the <argLine/>
path will change to ${project.build.directory}/test-classes
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With