Friday, June 15, 2007

Do Not Test!!!

The problem:

You would like to skip unit testing when using Maven.

The solution:

You can very easily tell Surefire, the plugin in Maven that handles testing, to not run tests. All you need to do is specify the system property 'maven.test.skip. Here is an example:
mvn -Dmaven.test.skip clean package

The above command will clean and package your project and will do so without running your tests. This is a very useful command in Maven. It comes in especially handy when trying to build someone else's project that contains non-portable test that run by default. These may keep you from building their project. Use this command to build the project and maybe install or deploy it.