Skip to content

Using Jackson2 with Maven

bimargulies edited this page Nov 12, 2012 · 2 revisions

Jackson 2.x is divided into a fairly large collection of artifacts to allow fine-grained dependency management. These are published to Maven Central under several different Maven groupId values, which can make it hard to find them in search.maven.org. The following is a set of Maven dependency declarations for the most common components, with some comments. In all cases here, ${jackson-2-version} is presumed to be a property set to the version you want to use.

 <!-- the core; this includes 'mapping' -->
 <dependency>
   <groupId>com.fasterxml.jackson.core</groupId>
   <artifactId>jackson-core</artifactId>
   <version>${jackson-2-version}</version>
 </dependency>

 <!-- Just the annotations; use this dependency if you want to attach annotations
      to classes without connecting them to the code. -->
 <dependency>
   <groupId>com.fasterxml.jackson.core</groupId>
   <artifactId>jackson-annotations</artifactId>
   <version>${jackson-2-version}</version>
</dependency>
<!-- databinding; JsonNode and related classes are here -->
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>${jackson-2-version}</version>
</dependency>
<!-- smile. Other artifacts in this group do other formats. -->
<dependency>
  <groupId>com.fasterxml.jackson.dataformat</groupId>
  <artifactId>jackson-dataformat-smile</artifactId>
  <version>${jackson-2-version}</version>
</dependency>
<!-- JAX-RS provider -->
<dependency>
   <groupId>com.fasterxml.jackson.jaxrs</groupId>
   <artifactId>jackson-jaxrs-json-provider</artifactId>
   <version>${jackson-2-version}</version>
</dependency>
<!-- JAX-B annotations -->
<dependency>
  <groupId>com.fasterxml.jackson.module</groupId>
  <artifactId>jackson-module-jaxb-annotations</artifactId>
  <version>${jackson-2-version}</version>
</dependency>
Clone this wiki locally