There could be situations when you would want to use the test classes and resources of a project as a test dependency in another project. This is typically the case in multi-module projects, where a module depends on another module. There could be utility code in the test classes of a module that can be reused in another module.
One way to achieve this would be by creating a separate project to hold these classes. However, that is cumbersome and may be confusing as well.
Maven provides another way to achieve this.
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> ...