我想在构建中添加一个设置,该设置将从 src 树中的某个位置复制特定文件,以便它们在开发和生产模式下的类路径上可用。我不想把它们放在public
文件夹,因为我不希望它们可供下载。我不想把它们放在conf
文件夹,因为我想保持配置文件的干净。
例如:
app
-- views
-- website
-- view.scala.html
-- header-module.widget
-- footer-module.widget
编译应用程序时,我希望类路径包含*.widget
文件下classpath:views/website/
而不是view.scala.html
因为这是单独处理的。
我想通过添加一个可以提供过滤器的 sbt 设置来做到这一点,我已经尝试过这个和一些变体,但到目前为止还没有工作:
val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
// Add your own project settings here
unmanagedResources in Compile <++= (sourceDirectory in Compile) map {
base: File => ( base / "views" ** "*. widget ").get
})
里面有以下内容.settings()
应该管用:
// Add app folder as resource directory so that widget files are in the classpath
unmanagedResourceDirectories in Compile <+= baseDirectory( _ / "app" ),
// but filter out java and html files that would then also be copied to the classpath
excludeFilter in Compile in unmanagedResources := "*.java" || "*.html"
我有某事。像这样在我们的 Build.scala 中将 mybatis xml 文件放在类路径中,它对我们有用。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)