Scala Play项目在添加swagger-play2依赖后失败构建 - sbt无法找到播放?

时间:2014-01-26 09:05:01

标签: scala sbt playframework-2.2 travis-ci swagger

我创建了一个sandbox play project进行测试。在building and passing the testsTravis CI。我添加了对swagger-play2的依赖,并且它开始使测试失败并显示错误消息:

sbt.ResolveException: download failed: com.typesafe.play#play_2.10;2.2.1!play_2.10.jar(src)

重现的步骤:

  1. 创建default play scala project
  2. 在添加swagger之前
  3. Build passes
  4. Adding swaggerbuild.sbt
  5. 立即构建fails :(
  6. Remove swagger dependency
  7. 再次构建passes
  8. 似乎很奇怪添加对swagger的依赖会触发此构建失败。我究竟做错了什么?如果您想测试修正,请随时在github project发送拉取请求((Travis应自动构建您的拉取请求)。

    完成GitHub项目历史记录:https://github.com/pathikrit/play-test/commits/master

    完成Travis-CI构建历史记录:https://travis-ci.org/pathikrit/play-test/builds

    提交触发构建失败:https://github.com/pathikrit/play-test/commit/d8ad88083b56dd0269eaefc30025a42f54f0dba5

5 个答案:

答案 0 :(得分:3)

我认为缺少Typesafe存储库。

检查你的project / plugins.sbt,它包含sbt-plugin包含和所需的类型安全repo解析:

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")

答案 1 :(得分:1)

请更新您的依赖项以使用swagger-play2-1.3.3:

"com.wordnik" %% "swagger-play2" % "1.3.3"

答案 2 :(得分:1)

我现在有一个脚本来设置依赖项:

PLAY_VERSION=2.2.1
wget http://downloads.typesafe.com/play/${PLAY_VERSION}/play-${PLAY_VERSION}.zip
      unzip play-${PLAY_VERSION}.zip -d ${HOME}
      # Manually populate the play directory with missing jars - TODO: remove this hack (see http://stackoverflow.com/questions/21361621/)
      SCALA_VERSION=2.10
      MAVEN_PLAY=http://repo.typesafe.com/typesafe/maven-releases/com/typesafe/play/play_${SCALA_VERSION}/${PLAY_VERSION}/play_${SCALA_VERSION}-${PLAY_VERSION}
      LOCAL_REPO=${HOME}/play-${PLAY_VERSION}/repository/local/com.typesafe.play/play_${SCALA_VERSION}/${PLAY_VERSION}
      mkdir ${LOCAL_REPO}/srcs/ ${LOCAL_REPO}/poms/
      wget ${MAVEN_PLAY}.pom --output-document ${LOCAL_REPO}/poms/play_${SCALA_VERSION}.pom
      wget ${MAVEN_PLAY}-sources.jar --output-document ${LOCAL_REPO}/srcs/play_${SCALA_VERSION}-sources.jar
      wget ${MAVEN_PLAY}-test-sources.jar --output-document ${LOCAL_REPO}/srcs/play_${SCALA_VERSION}-test-sources.jar

答案 3 :(得分:0)

我很快修复了manually downloading all the jars in my travis build script的构建。但是,我怀疑这是真正的解决方案 - 似乎添加swagger-play2假设某些罐子在特定目录中并且永远不会解析到其他地方......

答案 4 :(得分:0)

Swagger 1.3.1适用于Play 2.2.1。