Search code examples
scalaserializationintellij-ideakryo

Import Twitter/chill to Scala code using Intellij IDE


I have to do some assignments with Scala and I'm a newbie for this language. In the assignment, the prof requests me to implement serialization and deserialization, using twitter/chill. https://github.com/twitter/chill/

However, I don't know how to import the libary into my IDE Intellij.

Each time I use val instantiator = new ScalaKryoInstantiator. IDE notify me that: Cannot resolve symbol ScalaKryoInstantiator.

Could anyone can help me to resolve this issue?

Thanks and Best Regards,

Long.


Solution

  • One way to add a library in a Scala project, if you use sbt, is to add an sbt dependency. Most libraries and jars can be found and downloaded from the maven repositories: https://mvnrepository.com/artifact/com.twitter/chill_2.9.2/0.2.3

    If you click the sbt tab on the page above, maven gives you a code snippet which can be directly pasted into your build.sbt. In order to compile and run your project using sbt, open the terminal in the directory where your build.sbt is located and use the "sbt run" command.

    If you don't use sbt, download the jar from maven and follow the instructions in this answer: How to add external library in IntelliJ IDEA?