尝试使用Play 2.5.3但SBT在解决依赖关系时冻结

时间:2016-05-10 02:30:04

标签: java playframework sbt

我使用intellij并且已经遵循了这个文档:

https:// www.playframework.com/documentation/2.5.x/Migration25

我改变了plugins.sbt,就像这样:

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.3")

然后它被卡住了:

[debug]         tried https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.play/sbt-plugin/scala_2.10/sbt_0.13/2.5.3/ivys/ivy.xml

我检查了这个存储库,但没有2.5.3版本。

我做错了什么?

这是我的build.sbt:

name:=" play"

版本:=" 1.0"

lazy val play =(项目在文件中("。"))。enablePlugins(PlayJava)

scalaVersion:=" 2.11.7"

libraryDependencies ++ = Seq(   javaJdbc,cache,javaWs

unmanagedResourceDirectories in Test< + = baseDirectory(_ /" target / web / public / test")

解析器+ =" scalaz-bintray" at" https://dl.bintray.com/scalaz/releases"

这是我的项目/ plugins.sbt:

logLevel:= Level.Info

解析器+ =" Typesafe存储库" at" http://repo.typesafe.com/typesafe/releases/"

addSbtPlugin(" com.typesafe.play"%" sbt-plugin"%" 2.5.3")

另一个问题: 当我更改为2.4.6时,它可以工作,但还有另一个问题,项目刷新失败

java.lang.UnsupportedClassVersionError: com/typesafe/config/ConfigException : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at com.typesafe.sbt.web.SbtWeb$$anonfun$com$typesafe$sbt$web$SbtWeb$$load$1.apply(SbtWeb.scala:535)
at com.typesafe.sbt.web.SbtWeb$$anonfun$com$typesafe$sbt$web$SbtWeb$$load$1.apply(SbtWeb.scala:535)
at scala.Option.fold(Option.scala:157)

我的JDK是1.8

2 个答案:

答案 0 :(得分:0)

错误以某种方式显示在你添加的播放版本中存在拼写错误,请尝试以下plugins.sbt(这是我的sbt对我有用)删除你不想要的插件并添加你的内容使用但很适合您使用的版本:

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.3")

// Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
addSbtPlugin("org.irundaia.sbt" % "sbt-sassify" % "1.4.2")

// Play enhancer - this automatically generates getters/setters for public fields
// and rewrites accessors of these fields to use the getters/setters. Remove this
// plugin if you prefer not to have this feature, or disable on a per project
// basis using disablePlugins(PlayEnhancer) in your build.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")

// Play Ebean support, to enable, uncomment this line, and enable in your build.sbt using
// enablePlugins(PlayEbean). Note, uncommenting this line will automatically bring in
// Play enhancer, regardless of whether the line above is commented out or not.
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "3.0.1")


// Not necessary but useful for development
// https://github.com/jamesward/play-auto-refresh
//addSbtPlugin("com.jamesward" % "play-auto-refresh" % "0.0.14")

您可以通过以下方式验证版本:http://mvnrepository.com/artifact/com.typesafe.play

因为你使用2.5.x验证2_11下的版本而不是2_10,比如play_2.11而不是play_2.10,所以检查你的插件使用scala 2.11而不是2.10这可能是2.4.3工作而不是2.5.x。

答案 1 :(得分:0)

首先,确保您的sbt版本是最新的; project/build.properties应包含:

sbt.version=0.13.11

最新的sbt版本包括一些新的解析器;你只需将播放插件放在project/plugins.sbt

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.3")