gpt4 book ai didi

gradle - NoClassDefFoundError:使用Gradle插件运行Play 2.6时的java.sql.Date

转载 作者:行者123 更新时间:2023-12-03 05:09:53 25 4
gpt4 key购买 nike

有人玩过gradle插件吗?我正在尝试运行Play Framework 2.6入门项目。我可以从SBT正常运行,但是从gradle运行时出现以下错误:

play.api.UnexpectedException: Unexpected exception[NoClassDefFoundError: java/sql/Date]
at play.core.server.DevServerStart$$anon$1.reload(DevServerStart.scala:190)
at play.core.server.DevServerStart$$anon$1.get(DevServerStart.scala:124)
at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:202)
at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:117)
at akka.stream.impl.fusing.MapAsync$$anon$25.onPush(Ops.scala:1194)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:519)
at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:482)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:378)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:

我正在将Java 1.8与以下build.gradle结合使用:
plugins {
id 'play'
id 'idea'
}

def playVersion = "2.6.13"
def scalaVersion = System.getProperty("scala.binary.version", /* default = */ "2.12")

model {
components {
play {
platform play: playVersion, scala: scalaVersion, java: '1.8'
injectedRoutesGenerator = true

sources {
twirlTemplates {
defaultImports = TwirlImports.JAVA
}
}
}
}
}

dependencies {
play "com.typesafe.play:play-guice_$scalaVersion:$playVersion"
play "com.typesafe.play:play-logback_$scalaVersion:$playVersion"
play "com.h2database:h2:1.4.196"

playTest "org.assertj:assertj-core:3.6.2"
playTest "org.awaitility:awaitility:2.0.0"
}

repositories {
jcenter()
maven {
name "lightbend-maven-releases"
url "https://repo.lightbend.com/lightbend/maven-release"
}
ivy {
name "lightbend-ivy-release"
url "https://repo.lightbend.com/lightbend/ivy-releases"
layout "ivy"
}
}

最佳答案

您需要将java_home设置为使用Java 1.8版本。显然,play gradle插件需要一个Java home。

export JAVA_HOME=YOUR_JAVA_LOCATION
$ source .bash_profile

$ echo $JAVA_HOME

关于gradle - NoClassDefFoundError:使用Gradle插件运行Play 2.6时的java.sql.Date,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49764277/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com