Dark theme | Light theme

May 6, 2009

Skipping tests from Maven build in NetBeans

In NetBeans we can disable unit testing in a Maven project. I've been working on a project lately with a lot of different modules. Some of these modules contained failing unit test, but there was nothing I could do about it. In order to keep building the modules we can disable the unit testing.

We can define a custom goal for our Maven project. Therefore we must right-click on the project and select Custom | Goals.... NetBeans opens a dialog window. Here we select the checkbox Skip Tests to disable unit testing. We can save this goal with the name build (skip tests).

Now we have the custom goal available if we right-click on the project and go to Custom.

Another way to disable testing is go to Project Properties | Actions. We get the list of actions NetBeans uses and the Maven goals belonging to the actions. We select the Build project action and check the Skip tests checkbox. Now NetBeans will disable unit testing when we invoke the Build project command.