2

我尝试部署我的项目的当前版本。我集成了 webjars 和 jquery。

构建.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]
4

1 回答 1

3

WebJar 定位器在类路径中查找与jquery.min.js搜索路径匹配的多个文件。您应该检查您的类路径,看看还有什么包含与该查询匹配的文件,并删除导致重复文件的任何内容。

于 2015-03-08T13:56:27.023 回答