2010-09-28 126 views
2

据对changing paths我试图改变“目标”输出目录SBT教程“一些其它”更改SBT项目的目录布局

override def outputDirectoryName = "someother" 

一切顺利,除了一个:SBT自动创建”目标目录。历史“文件里面。为什么sbt这样做,当它应该创建只有“别的”目录?我tryied要覆盖从BasicProjectPaths继承的方法(我用sbt.DefaultProject为我的项目描述符的超)

override def mainCompilePath = ... 
override def testCompilePath = ... 
... 

但SBT尽管路径覆盖创建“目标”文件夹中。

回答

2

一定是的,它应该在后备箱使用重写outputDirectoryName ...

/** The path to the file that provides persistence for history. */ 
def historyPath: Option[Path] = Some(outputRootPath/".history") 
def outputPath = crossPath(outputRootPath) 
def outputRootPath: Path = outputDirectoryName 
def outputDirectoryName = DefaultOutputDirectoryName 

from SBT's current trunk)。

它可能在以前的版本中有所不同。你考虑过raising a new bug吗?

0

在SBT 0.13.5,我发现了一种通过在build.sbt文件刚刚重新分配目标以改变目标文件夹:

目标:=文件(“someotherParent”)/“someotherSubdir”

这只会修改构建类和工件的目录,但.history文件始终位于项目根目录中。

不幸的是,其他一些插件(xsbt-web-plugin)似乎有问题 - 通过SBT控制台运行webapp会产生奇怪的错误,当我切换回标准目录布局时,这些问题就消失了。

0

实现我的目标(一个目录中的所有JARS,其名称包含JAVA-VM版本)的更好方法似乎是指定一个合适的发布目标 - 对“sbt publish”的限制较少,和其他插件不会受到不同目录布局的干扰。