Adding dependency from local maven repository to a Play project

I wanted to add a REST API layer to my java project and decided to use Play framework for the REST APIs. This way, in future I can also use Play to serve static web content.

Play framework uses SBT & Ivy whereas I had used Maven for my Java project. To be able to add the jar as dependency and get it working I had to do the below.

PS: I am using Play 2.3.x

1. Add the dependency in build.sbt and also a resolver pointing to my local Maven repository.

libraryDependencies ++= Seq(
 "my.group" % "my-project" % "1.0-SNAPSHOT",
 javaJdbc,
 javaEbean,
 cache,
 javaWs
)

resolvers += Resolver.mavenLocal

2. Do an “activator update”

3. Do an “activator eclipse”

4. Refreshed the project in eclipse.

The main trick was step#2 to update.
You could also use resolver like below:

resolvers += (
 "Local Maven Repository" at "file:///"+Path.userHome.absolutePath+"/.m2/repository"
)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s