Home > java, maven > Maven ‘skip tests’ & test-jar dependency errors

Maven ‘skip tests’ & test-jar dependency errors

If you use test-jar dependencies in a multi-module Maven project (see my previous posting) you will run into a problem when you run Maven install with the maven.test.skip option turned on.

Problem

Maven looks for dependencies on test-jars even when maven.test.skip is turned on. This posting on the Maven issue tracker site perfectly summarizes the problem.

The maven.test.skip option (which is equivalent to the ‘Skip tests’ checkbox in IntelliJ’s Maven Runner options) prevents test code compilation, packaging and execution.

Hence no test-jars are built and that leads to the dependency error described above.

Solution

Disable the ‘Skip Tests’ checkbox in IntelliJ and INSTEAD add a property skipTests with value true.

This causes all test code to be built (and packaged as test-jars – when configured as described in my last posting) and only disables the execution of the tests.

Maven test execution options

maven.test.skip
Disables both running the tests and compiling the tests.

skipTests
Set this to true to skip running tests, but still compile them

Advertisements
Categories: java, maven
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: