我想在构建中添加一个设置,它将从src tree中的某个位置复制特定的文件,以便它们在开发和生产模式下的类路径中可用。我不想将它们放在public文件夹中,因为我不希望它们可供下载。我不想把它们放在conf文件夹中,因为我想保持配置文件的整洁。
例如:
app
-- views
-- website
-- view.scala.html
-- header-module.widget
-- footer-module.widget在编译应用程序时,我希望类路径包含classpath:views/website/下的*.widget文件,而不是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
})发布于 2013-01-31 06:16:24
下面的.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"我有s.th。就像这样,在我们的Build.scala中,在类路径中有mybatis xml文件,它为我们工作。
https://stackoverflow.com/questions/14601982
复制相似问题