2

I'm trying to add "com.google.api-ads" % "adwords-axis" % "1.23.0" as a dependency in build.sbt file in a Play 2.2.1 project. When I do play eclipse for generating the eclipse project file, I get the following error:

[error] (*:update) sbt.ResolveException: unresolved dependency: com.google.http-client#google-http-client-jackson2;RELEASE: not found

Later I found out that adwords-axis depends on ads-lib which has the following dependency (note RELEASE version):

<dependency>
  <groupId>com.google.http-client</groupId>
  <artifactId>google-http-client-jackson2</artifactId>
  <version>RELEASE</version>
</dependency>

I read that the version can be specified as RELEASE in Maven in this answer.

Does SBT not allow specifying the version as RELEASE? If so, is there a workaround to use adwords-axis dependency?

Community
  • 1
  • 1
livinston
  • 1,218
  • 2
  • 12
  • 18

1 Answers1

0

I don't think there is such functionality in SBT and it is probably also not a good idea since the API might change totally between two releases and your project would then download any new version making your build non-repeatable, if you check out an old version from your VCS its not certain that it will compile etc. So it is a pretty bad decision by the project maintainers of the library that uses RELEASE as the version of any dependency.

What you can do though is to figure out what version it would resolve to now, if it really works and then override the transitive dependency with that specific version of google-http-client-jackson2 and depend directly on that.

So for example (not that I'm just randomly guessing that 0.17.0-rc would be a good version):

libraryDependencies := Seq(
  "com.google.api-ads" % "adwords-axis" % "1.23.0",
  "com.google.http-client" % "google-http-client-jackson2" % "1.17.0-rc"
)
johanandren
  • 11,249
  • 1
  • 25
  • 30
  • I have seen excluding transitive dependencies in maven. I'll try what you have suggested and get back. Thanks – livinston Jan 29 '14 at 11:13
  • There is also support for excluding transitive dependencies in a few ways in sbt, but I guessed that you will actually need the http-client. – johanandren Jan 29 '14 at 13:21