I'm using Maven 3.0.3, GWT 2.4 on Linux. I want to set the GWT headless mode when running some tests (e.g. setting the -Djava.awt.headless=true). My question is, how do I set that parameter when running my GWT tests through Maven? I run my GWT tests by running
mvn clean test
Thanks, - Dave
If you want to run just a single test instead of all the tests declared in your project, create a Maven run configuration for a single test with the Maven -Dtest=TestName test command.
To skip running the tests for a particular project, set the skipTests property to true. You can also skip the tests via the command line by executing the following command: mvn install -DskipTests.
maven-verifier-plugin simply verifies the existence/absence of files on the filesystem. You could use it for functional testing, but you may need more features than maven-verifier-plugin provides.
We can run our unit tests with Maven by using the command: mvn clean test. When we run this command at command prompt, we should see that the Maven Surefire Plugin runs our unit tests.
You can pass configuration parameters through the surefire plugin. Like:
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<systemPropertyVariables>
<java.awt.headless>true</java.awt.headless>
</systemPropertyVariables>
</configuration>
</plugin>
...
Reference: http://maven.apache.org/surefire/maven-surefire-plugin/examples/system-properties.html
The old version of this answer used the now deprecated "systemProperties" which you need to use for older surefire versions:
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<systemProperties>
<java.awt.headless>true</java.awt.headless>
</systemProperties>
</configuration>
</plugin>
...
For more configuration options check out the Surefire manual page: http://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html
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