我尝试部署我项目的当前版本。我有webjars和jquery整合。
build.sbt
...
libraryDependencies ++= Seq(
"org.webjars" %% "webjars-play" % "2.3.0-3",
"org.webjars" % "jquery" % "2.1.3"
)
...
login.scala.html
...
</body>
<script type='text/javascript' src='@routes.WebJarAssets.at(WebJarAssets.locate("jquery.min.js"))'></script>
...
路由
...
GET /assets/*file controllers.Assets.at(path="/public", file)
GET /webjars/*file controllers.WebJarAssets.at(file)
当我尝试开始时,我得到了这个例外
play.api.Application$$anon$1: Execution exception[[MultipleMatchesException: Multiple matches found for jquery.min.js. Please provide a more specific path, for example by including a version number.]]
at play.api.Application$class.handleError(Application.scala:296) ~[com.typesafe.play.play_2.11-2.3.8.jar:2.3.8]
at play.api.DefaultApplication.handleError(Application.scala:402) [com.typesafe.play.play_2.11-2.3.8.jar:2.3.8]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:205) [com.typesafe.play.play_2.11-2.3.8.jar:2.3.8]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:202) [com.typesafe.play.play_2.11-2.3.8.jar:2.3.8]
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36) [org.scala-lang.scala-library-2.11.5.jar:na]
Caused by: org.webjars.MultipleMatchesException: Multiple matches found for jquery.min.js. Please provide a more specific path, for example by including a version number.
at org.webjars.WebJarAssetLocator.getFullPath(WebJarAssetLocator.java:201) ~[org.webjars.webjars-locator-0.19.jar:na]
at org.webjars.WebJarAssetLocator.getFullPath(WebJarAssetLocator.java:167) ~[org.webjars.webjars-locator-0.19.jar:na]
at controllers.WebJarAssets.locate(WebJarAssets.scala:49) ~[org.webjars.webjars-play_2.11-2.3.0-3.jar:1.0.2]
at views.html.application.login$.apply(login.template.scala:142) ~[myprog.myprog-1.0.2.jar:1.0.2]
at controllers.Application$$anonfun$loginForm$1.apply(Application.scala:30) ~[myprog.myprog-1.0.2.jar:1.0.2]
答案 0 :(得分:2)
WebJar定位器在类路径中查找与jquery.min.js
搜索路径匹配的多个文件。您应该检查您的类路径以查看其他包含与该查询匹配的文件以及删除导致重复文件的任何内容。