Regarding Rich Seller's answer: The use of <classifier>tests</classifier> is out dated see the user’s guide.
I am using maven 2.2.1 and maven-jar-plugin 2.2 and it required to switch <type>test-jar</type> instead of <classifier>tests</classifier>.
Note that tests jar are not transitive and so you may need to add them explicitly.
<project> ... <dependencies> <dependency> <groupId>name.seller.rich</groupId> <artifactId>foo</artifactId> <version>1.0.0</version> <type>test-jar</type> <scope>test</scope> </dependency> </dependencies> ... </project>
Update following Mike Sokolov comment:
The user’s guild for maven 3 updated on 2014-03-28 see link above say’s
Note that previous editions of this guide suggested to use <classifier>tests</classifier> instead of <type>test-jar</type>. While this currently works for some cases, it does not properly work during a reactor build of the test JAR module and any consumer if a lifecycle phase prior to install is invoked. In such a scenario, Maven will not resolve the test JAR from the output of the reactor build but from the local/remote repository. Apparently, the JAR from the repositories could be outdated or completely missing, causing a build failure (cf. MNG-2045).