7
爲了在我的Play應用程式使用WebJars我已經添加了以下路線如何添加WebJars到我的Play應用程序?
GET /webjars/*file controllers.WebJarAssets.at(file)
在我的斯卡拉模板我已經添加了以下行:
<link rel='stylesheet' href='@routes.WebJarAssets.at(WebJarAssets.locate("css/bootstrap.min.css"))'>
<link rel='stylesheet' href='@routes.WebJarAssets.at(WebJarAssets.locate("css/bootstrap-theme.min.css"))'>
當我打開應用程序,該css文件完美加載。但只要我跑activator eclipse
,我得到以下編譯錯誤:
[info] Compiling 4 Scala sources and 2 Java sources to /Users/d135-1r43/play/blog/target/scala-2.11/classes...
[error] /Users/d135-1r43/play/blog/conf/routes:10: object WebJarAssets is not a member of package controllers
[error] GET /webjars/*file controllers.WebJarAssets.at(file)
[error] /Users/d135-1r43/play/blog/conf/routes:10: object WebJarAssets is not a member of package controllers
[error] GET /webjars/*file controllers.WebJarAssets.at(file)
[error] /Users/d135-1r43/play/blog/app/views/main.scala.html:8: not found: value WebJarAssets
[error] <link rel='stylesheet' href='@routes.WebJarAssets.at(WebJarAssets.locate("css/bootstrap.min.css"))'>
[error] ^
[error] /Users/d135-1r43/play/blog/app/views/main.scala.html:9: not found: value WebJarAssets
[error] <link rel='stylesheet' href='@routes.WebJarAssets.at(WebJarAssets.locate("css/bootstrap-theme.min.css"))'>
[error] ^
[error] four errors found
[error] (compile:compile) Compilation failed
[error] Could not create Eclipse project files:
[error] Error evaluating task 'dependencyClasspath': error
任何想法,這裏發生了什麼?我需要添加一些東西到我的類路徑中嗎?
'webjars-play'samware your dependencies?您需要將它添加到您的構建文件中:'libraryDependencies + =「org.webjars」%%「webjars-play」%「2.3.0-2」' –