我使用的播放框架2.4我的应用程序工作正常安装UI组件如前(grunt
,ruby
,npm
,cpmpass
)我不很了解他们,但我需要这些为我的项目UI
工作有一个文件夹node_modules
下的public
目录的播放应用程序这是造成太多的时间来运行/测试项目,每当我给run
或test
命令我已经看到很多文件夹正在启动在位置创建如何停止node_modules文件夹进入游戏框架的目标目录2.4
playapp/target/web/classes/main/META-INF/resources/webjars/playapp/0.1.0-7708ad295b8fe2c87a28bdb6afa7c10401c12a61-SNAPSHOT/node_modules
我该如何避免这种情况? 这里有一些解决方案,我已经试过,但没有奏效
- https://www.playframework.com/documentation/2.4.x/SBTCookbook
- Include/Exclude asset folder/directory in sbt/play-framework
项目/咕噜
import play.PlayRunHook
import sbt._
import java.net.InetSocketAddress
object Grunt {
def apply(base: File): PlayRunHook = {
object GruntProcess extends PlayRunHook {
var process: Option[Process] = None
override def beforeStarted(): Unit = {
Process("grunt dist", base).run
}
override def afterStarted(addr: InetSocketAddress): Unit = {
process = Some(Process("grunt watch", base).run)
}
override def afterStopped(): Unit = {
process.map(p => p.destroy())
process = None
}
}
GruntProcess
}
}
这里是build.sbt的一部分文件 编辑
import Grunt._
import play.PlayImport.PlayKeys.playRunHooks
import play.sbt.PlayImport.PlayKeys.playRunHooks
lazy val gruntDirectory = baseDirectory {
_/"public"
}
excludeFilter := HiddenFileFilter -- ".tmp"
unmanagedResourceDirectories in Assets <+= gruntDirectory { _/"dist"}
unmanagedResourceDirectories in Assets <+= gruntDirectory { _/".tmp"}
unmanagedResourceDirectories in Assets <+= gruntDirectory { _/"bower_components"}
unmanagedResourceDirectories in Assets <+= gruntDirectory { _/"node_modules"}
//this is for development environment
unmanagedResourceDirectories in Assets <+= gruntDirectory { _/"src"/"app"}
playRunHooks <+= baseDirectory.map(base => Grunt(base))
但还是目标文件夹得到填补与上run
和test
命令创建它的很多文件夹里面的文件夹node_modules,请帮助。 编辑
我已经添加
unmanagedResourceDirectories in Assets <+= gruntDirectory { _/"node_modules"}
这条线,但现在我gettig这个错误
[trace] Stack trace suppressed: run last playapp/web-assets:webExportedDirectory for the full output.
[error] (playapp/web-assets:webExportedDirectory) Duplicate mappings:
[error] playapp/target/web/classes/main/META-INF/resources/webjars/arteciate/0.1.0-7708ad295b8fe2c87a28bdb6afa7c10401c12a61-SNAPSHOT/requirejs/require.js
[error] from
[error] playapp/public/bower_components/requirejs/require.js
[error] /home/sara/git/arteciate/public/node_modules/requirejs/require.js
[error] playapp/target/web/classes/main/META-INF/resources/webjars/arteciate/0.1.0-7708ad295b8fe2c87a28bdb6afa7c10401c12a61-SNAPSHOT/requirejs/README.md
[error] from
[error] playapp/public/bower_components/requirejs/README.md
[error] playapp/public/node_modules/requirejs/README.md
[error] Total time: 5 s, completed Aug 8, 2017 5:09:17 PM
公用文件夹具有下列内容
app bower.json dist Gruntfile.js node_modules README.md test
bower_components config fonts Gruntfile.js~ package.json _SpecRunner.html
和,我想再问一个问题我不知道这些UI组件如何UI工具实际上如何工作,如npm, yeoman, bower, sass, grunt
,什么是node_modules
和它们是什么和“我真的需要我的构建过程中使用sbt模块”
你在哪里添加跳过node_modules文件夹??? –
'''非托管资源目录中的资产<+ = gulpDirectory {_ /“node_modules”} ''' –
请参阅我编辑的问题 – swaheed