We are using Maven in Hudson to run our Java build process and the Surefire plugin to execute JUnit tests however I\'ve run into a problem with the unit tests for one projec
To add a system property to the JUnit tests, configure the Maven Surefire Plugin as follows:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.library.path>${project.basedir}/src/main/native/Authenticator/Release</java.library.path>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
Update:
Ok, it seems this property has to be set before the JVM with JUnit tests starts. So I guess that you have problem with the backslashes. Backslashes in the Java property value are used to escape special characters like \t
(tabulator) or \r\n
(windows new-line). So try to use this instead of your solution:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>once</forkMode>
<argLine>-Djava.library.path=${project.basedir}/src/main/native/Authenticator/Release</argLine>
</configuration>
</plugin>
</plugins>
</build>