How to re-use test code between projects

Just follow http://maven.apache.org/guides/mini/guide-attached-tests.html.

It doesn't explain why you should use

<type>test-jar</type>

instead of

<classifier>tests</classifier>

but one reason I can think of is that by using the type tag, you reduce the possible confusion with using type of jar and classifier of tests.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jan 02, 2007

    Bae says:

    This may be because the pom.xml docs provide this information: http://maven.apa...

    This may be because the pom.xml docs provide this information:

    http://maven.apache.org/ref/2.0.4/maven-model/maven.html#class_dependency

    type

    The type of dependency. This defaults to jar. While it usually represents the extension on the filename of the dependency, that is not always the case. A type can be mapped to a different extension and a classifier. The type often correspongs to the packaging used, though this is also not always the case. Some examples are jar, war, ejb-client and test-jar. New types can be defined by plugins that set extensions to true, so this is not a complete list.

  2. Jan 22, 2007

    Jacob Robertson says:

    That paragraph explains what the "type" is, but doesn't explain why it should be...

    That paragraph explains what the "type" is, but doesn't explain why it should be used in preference to "classifier" especially in the case where either will work.