2014-10-29 127 views
1

這是我的Build.scala文件。我正在嘗試將一些com.google.api-ads庫依賴項導入到我的項目中,並且不斷收到錯誤,指出「未解決的依賴項路徑」。不過,我可以看到這些庫在Maven回購站中。與SBT的Google Ads API依賴關係

我已經嘗試過各種版本,並嘗試導入google-http-client依賴關係,這是對ads-lib和dfp-axis庫的傳遞依賴關係。

object Build extends Build { 
    val commonSettings = Seq(
    version := "1.0.0", 
    organization := "com.collective", 
    scalaVersion := "2.11.2", 
    scalacOptions ++= List(
     "-encoding", "UTF-8", 
     "-target:jvm-1.7", 
     "-feature", 
     "-unchecked", 
     "-deprecation", 
     "-Xlint", 
     "-Xfatal-warnings" 
    ) 
    ) 

    val akkaV = "2.3.6" 
    val sprayV = "1.3.2" 
    val adsLibVersion = "1.30.0" 

    lazy val segmentFetcher = Project("segment-fetcher", file(".")) 
    .settings(commonSettings: _*) 
    .settings(
    name := "Segment Fetcher", 
    libraryDependencies ++= Seq(
     "com.typesafe.akka"  %% "akka-actor"   % akkaV, 
     "com.typesafe.akka"  %% "akka-testkit"   % akkaV  % "test", 
     "org.specs2"    %% "specs2-core"   % "2.3.11" % "test", 
     "io.spray"    %% "spray-can"   % sprayV, 
     "io.spray"    %% "spray-client"   % sprayV, 
     "io.spray"    %% "spray-httpx"   % sprayV, 
     "io.spray"    %% "spray-routing"  % sprayV, 
     "io.spray"    %% "spray-testkit"  % sprayV % "test" 
     "com.google.api-ads"  %% "ads-lib"    % adsLibVersion, 
     "com.google.api-ads"  %% "ads-lib-axis"   % adsLibVersion, 
     "com.google.api-ads"  %% "dfp-axis"    % adsLibVersion 

    ) 
    ) 
} 

當我運行SBT編譯,我得到了com.google.api的廣告依賴性

> compile 
[info] Updating {file:/Users/anand/IntellijProjects/segments-fetcher/}segment-fetcher... 
[info] Resolving com.google.api-ads#ads-lib_2.11;1.30.0 ... 
[warn] module not found: com.google.api-ads#ads-lib_2.11;1.30.0 
[warn] ==== local: tried 
[warn] /Users/anand/.ivy2/local/com.google.api-ads/ads-lib_2.11/1.30.0/ivys/ivy.xml 
[warn] ==== public: tried 
[warn] https://repo1.maven.org/maven2/com/google/api-ads/ads-lib_2.11/1.30.0/ads-lib_2.11-1.30.0.pom 
[info] Resolving com.google.api-ads#ads-lib-axis_2.11;1.30.0 ... 
[warn] module not found: com.google.api-ads#ads-lib-axis_2.11;1.30.0 
[warn] ==== local: tried 
[warn] /Users/anand/.ivy2/local/com.google.api-ads/ads-lib-axis_2.11/1.30.0/ivys/ivy.xml 
[warn] ==== public: tried 
[warn] https://repo1.maven.org/maven2/com/google/api-ads/ads-lib-axis_2.11/1.30.0/ads-lib-axis_2.11-1.30.0.pom 
[info] Resolving com.google.api-ads#dfp-axis_2.11;1.30.0 ... 
[warn] module not found: com.google.api-ads#dfp-axis_2.11;1.30.0 
[warn] ==== local: tried 
[warn] /Users/anand/.ivy2/local/com.google.api-ads/dfp-axis_2.11/1.30.0/ivys/ivy.xml 
[warn] ==== public: tried 
[warn] https://repo1.maven.org/maven2/com/google/api-ads/dfp-axis_2.11/1.30.0/dfp-axis_2.11- 1.30.0.pom 
[info] Resolving jline#jline;2.12 ... 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] ::   UNRESOLVED DEPENDENCIES   :: 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] :: com.google.api-ads#ads-lib_2.11;1.30.0: not found 
[warn] :: com.google.api-ads#ads-lib-axis_2.11;1.30.0: not found 
[warn] :: com.google.api-ads#dfp-axis_2.11;1.30.0: not found 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] 
[warn] Note: Unresolved dependencies path: 
[warn]  com.google.api-ads:ads-lib_2.11:1.30.0 (/Users/anand/IntellijProjects/segments- fetcher/project/Build.scala#L29) 
[warn]  +- com.collective:segment-fetcher_2.11:1.0.0 
[warn]  com.google.api-ads:ads-lib-axis_2.11:1.30.0 (/Users/anand/IntellijProjects/segments-fetcher/project/Build.scala#L29) 
[warn]  +- com.collective:segment-fetcher_2.11:1.0.0 
[warn]  com.google.api-ads:dfp-axis_2.11:1.30.0 (/Users/anand/IntellijProjects/segments-fetcher/project/Build.scala#L29) 
[warn]  +- com.collective:segment-fetcher_2.11:1.0.0 
[trace] Stack trace suppressed: run last *:update for the full output. 
[error] (*:update) sbt.ResolveException: unresolved dependency: com.google.api-ads#ads-lib_2.11;1.30.0: not found 
[error] unresolved dependency: com.google.api-ads#ads-lib-axis_2.11;1.30.0: not found 
[error] unresolved dependency: com.google.api-ads#dfp-axis_2.11;1.30.0: not found 
[error] Total time: 5 s, completed 29 Oct, 2014 3:31:25 PM 

回答

1

%%是一個特殊的SBT運算符後綴斯卡拉版本的工件,在未解決的依賴錯誤從MAVEN獲取。嘗試用%替換%%以獲得Java MAVEN依賴關係(Google很可能是依賴關係)。

你可能注意到了SBT試圖獲取神器

com.google.api-ads#ads-lib_2.11;1.30.0 

而應該取(不含2.11後綴)

com.google.api-ads#ads-lib;1.30.0