How to add AWS Java SDK to Scala / Play project

CodeMonkey :

I'm playing around with Scala and Play, where I want to use the AWS Java SDK.

I need to add the SDK to the project. And I know that I need to do that using the plugins.sbt.

What I have tried

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

addSbtPlugin("com.amazonaws" % "aws-java-sdk" % "1.11.46")

It's saying:

unresolved dependencies: Error:Unresolved dependencies:com.amazonaws#aws-java-sdk;1.11.46: not found`

As I am new to both Java, Scala and sbt I can't figure out what I am doing wrong.

The solution

I was wrong about where to put the reference. It goes in build.sbt as it is not an sbt plugin, but rather a framework for the application to use.

Add the reference to build.sbt like this:

libraryDependencies ++= Seq(
  "com.amazonaws" % "aws-java-sdk" % "1.11.46"
)

And you are good to go. You don't need a reference to any repositories, since the aws sdk is available in the default repos.

See a list of available AWS Java SDK versions

TheM00s3 :

Your problem is with SBT, the framework needs to be placed within build.sbt but you're trying to import it in as a plugin which it is not. Remove the plugin above, and put this line within your build.sbt:

libraryDependencies ++= Seq(
  "com.amazonaws" % "aws-java-sdk" % "1.11.46"
)

The have sbt build from there. If you are using Intelli J you can enable auto-import and have sbt automatically begin importing new or modified dependencies.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=456084&siteId=1