Question

I'm a beginner of the play framework 2(2.2.1) and want to use open csv inside it. I searched for a maven repository, then add a line bellow inside the file build.sbt

libraryDependencies ++= Seq(
  "net.sf.opencsv" % "opencsv" % "2.3" from "http://central.maven.org/maven2/net/sf/opencsv/opencsv/2.3/opencsv-2.3.pom"
)

I'm sure that the pom file locates at

http://repo1.maven.org/maven2/net/sf/opencsv/opencsv/2.3/opencsv-2.3.pom

but the play console says that it search for

http://repo1.maven.org/maven2/net/sf/opencsv/opencsv_2.10_0.13/2.3/opencsv-2.3.pom

then it fails.

How can I use the library correctly?

Was it helpful?

Solution

I assume you have added the line to the project/build.sbt file. The way sbt works is kind of confusing. The /project/build.sbt file defines the dependencies of the build itself. That is why it looks for a dependency that matches your scala version (2.10) as well as your sbt version (0.13).

To add a dependency to your project rather than your build (I know it is confusing), you would have to add the line either to /build.sbt or /project/Build.scala depending of which kind of Build definition you use (See this sbt doc entry for explanation)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top