Maven dependency types 

Joined:
08/13/2009
Posts:
172

September 06, 2009 20:22:29    Last update: September 06, 2009 20:22:29
In a Maven dependency declaration, the type element corresponds to the dependant artifact's packaging type. It defaults to jar if omitted.

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.

New types can be defined by plugins that set extensions to true.

Some examples are: jar, war, ejb, ejb-client.

This is a typical declaration (type can be omitted since it defaults to jar):
<dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.0</version>
      <type>jar</type>
      <scope>test</scope>
      <optional>true</optional>
    </dependency>
    ...
</dependencies>
Share |
| Comment  | Tags