简体   繁体   中英

How to define Jackson databinding dependency in build.sbt?

I want to use the Jackson databinding API in a Scala/Java project, that is managed by sbt. The Jackson dependency should be as slim as possible, no Scala stuff etc.

How do I depend on Jackson 2.4 from build.sbt ?

Jackson will be used like this from my code:

import com.fasterxml.jackson.databind.ObjectMapper;

ObjectMapper mapper = new ObjectMapper();
mapper.writeValue(dst, myBean);

For SBT read up on the documentation , in there it states you can add dependencies with:

libraryDependencies += groupID % artifactID % revision

The dependencies come out of a usually remote repository which seems to include Maven Central, so search for what you need there . Then you should end up with something like this:

libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.4.0"

( Assuming this is the actual dependency, 2.4 is referenced from the question, personally I use the codehaus builds )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM