3
在SBT插件中,我试图访问子项目的托管资源。SBT:访问子项目的管理资源?
这里是构建文件:
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val appName = "demo"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
"org.jruby" % "jruby-complete" % "1.7.1"
)
val widgets = play.Project("widgets", appVersion, appDependencies, path = file("widgets"))
val main = play.Project(appName, appVersion, appDependencies, path = file("demo"))
.dependsOn(widgets)
}
我在plugins.sbt定义的SBT插件工作。
现在,我需要父项目(演示)的编制过程中从子项目(小工具)使用的资源文件。
到目前为止,我已经到了最接近的是buildDependencies设置关键 - 但我只得到ProjectRef对象,唯一的信息是建基地和项目ID。我无法找到到该项目的资源目录的方法。
该帖指的是可从插件类装载器类和资源。这意味着'Class.forName(...,getClass.getClassLoader)'和'getClass.getClassLoader.getResource(...)'。另外,它只是谈论为构建定义定义的类和资源。也就是'project /'中的那个,而不是主项目。 一个插件仍然可以使用设置/任务像往常一样获得相应项目的资源和类'File's。 –