Playframework 2.5.4 sbt less编译失败

时间:2016-08-10 15:38:11

标签: java sbt less playframework-2.5 webjars

我终于有时间使用" play-java"与激活器一起设置一个新游戏(版本2.5.4)项目。模板。 在我的build.sbt中,我添加了以下行以使用较少的bootstrap,如here所述。

"org.webjars" % "bootstrap" % "3.3.7"

我还创建了文档

中描述的文件夹结构
app
 |---> assets
           |---> stylesheets

只有一个简单的 main.less ,其中包含以下几行:

@import "lib/bootstrap/less/bootstrap.less";

body {
  color: aqua;
}

现在,当我调用activator runactivator stageactivator dist时,所有内容都会编译而不会出现错误,并且在调用 localhost:9000 时会包含引导程序在 main.css 中按预期进行。

编辑:首先我认为只有heroku会出现以下问题,但在本地计算机上使用sbt clean compile stage时,我也会收到以下错误:

[info] LESS compiling on 1 source(s)
[error] /tmp/scala_buildpack_build_dir/app/assets/stylesheets/main.less:1: 'lib/bootstrap/less/bootstrap.less' wasn't found. Tried - /tmp/scala_buildpack_build_dir/app/assets/stylesheets/lib/bootstrap/less/bootstrap.less,/tmp/scala_buildpack_build_dir/app/assets/lib/bootstrap/less/bootstrap.less,/tmp/scala_buildpack_build_dir/target/web/less/main/lib/bootstrap/less/bootstrap.less,/tmp/scala_buildpack_build_dir/public/lib/bootstrap/less/bootstrap.less,/tmp/scala_buildpack_build_dir/target/web/web-modules/main/webjars/lib/bootstrap/less/bootstrap.less,lib/bootstrap/less/bootstrap.less
[error] @import "lib/bootstrap/less/bootstrap.less";     
[error] ^
[error] one error found
[error] (web-assets:less) com.typesafe.sbt.web.CompileProblemsException
[error] Total time: 5 s, completed Aug 10, 2016 2:53:01 PM
!     ERROR: Failed to run sbt!

似乎使用sbt,编译时可以处理包含来自外部库的bootstrap.less的较少编译。 激活器工作正常。

是否有其他人遇到类似问题,或者知道可能导致此错误的原因是什么?

1 个答案:

答案 0 :(得分:4)

通常,在构建期间,引导程序webjar的较少文件应被提取到target/web/web-modules/main/webjars/lib/bootstrap/less/bootstrap.less

但是你正在使用的版本的Jar文件错过了这个文件:

自举-3.3.7.jar \ META-INF \资源\ webjars \自举\ 3.3.7 \ css fonts js webjars-requirejs.js webjars-requirejs.js.gz

在版本3.3.4中,存在的文件越少。