当前位置: 首页 > 知识库问答 >
问题:

Google广告API与SBT的依赖关系

督德泽
2023-03-14
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 compile时,我得到com.google.api-ads依赖项的unresolved dependencies错误

> 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个答案

陈毅
2023-03-14

%%是一个特殊的SBT运算符,它将Scala版本后缀为要从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
 类似资料:
  • 我试图构建一个具有spark依赖关系的非常基本的scala脚本。但我不能用它做罐子。 我的scala源代码在: /exampleapp/main/scala/example/hello.scala 项目名为exampleapp。

  • 参考:https://developers.google.com/google-ads/api/docs/start 引用(我的重点): Google广告API是AdWords API的下一代。它可以通过gRPC和JSON REST从各种客户端环境访问。 这表明存在REST API。 然而,我找不到它的任何文档,任何endpoint——任何真正的东西。 他们的意思是说,他们在客户端库中暗中使用了它

  • 我使用SBT创建了一个scala项目,并使用Scalatest编写了一些单元测试用例。但不知何故找不到org.scalatest包。 下面是我的项目定义文件:

  • 使用IntelliJ最新的scala插件sbt 13.8和scala 2.11.7的新sbt项目,我尝试添加一个库-akka 2.4.2。在此之后,我简单地添加 [信息]解析org.scala-sbt#testing;0.13.8... [信息]解析org.scala-sbt#test-agent;0.13.8... [信息]解析org.scala-SBT#test-interface;1.0..