A23
A23

Reputation: 1606

Adding Gson to Play2 Framework

I've read through the SBT Documentation but am unable to find a proper answer for projects without Build.scala. This is a pure java based project.

Here is my build.sbt file -

name := """newproject"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayJava)

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  javaWs,
  "com.google.code.gson" % "gson" % "2.2.4"
)

When I run make, everything compiles and resolves as expected but when I try to use Gson in my project, I get cannot find symbol. Manually importing "com.google.code.gson" doesn't work either.

I'm looking for a way to use Managed Dependencies and not Unmanaged (referring to this post). Could someone please point me in the right direction? Is there a way I can have define App Dependencies without Build.scala?

Update -

I'm using IntelliJ and I can see com.google.code.gson in External Libraries. I tried to re-sync the project and invalidating the cache.

Upvotes: 0

Views: 1426

Answers (2)

runcode
runcode

Reputation: 3643

in your project root directory , type

play ~idea

Upvotes: 0

Steve Chaloner
Steve Chaloner

Reputation: 8202

Did you restart Play, or use the reload command after updating build.sbt?

Additionally, if you're using an IDE, you'll need to re-generate the IDE files to include a reference to GSON. If you're using IntelliJ, use the idea command; for Eclipse, it's eclipse.

Upvotes: 1

Related Questions