【问题标题】:Changing sbt project's directory layout更改 sbt 项目的目录布局
【发布时间】:2011-04-18 08:31:16
【问题描述】:

根据changing paths 上的 sbt 教程,我正在尝试将“目标”输出目录更改为“其他”

override def outputDirectoryName = "someother"

一切都很好,除了一个:sbt 自动创建包含“.history”文件的目标目录。为什么 sbt 在它应该创建 only "someother" 目录时这样做?我尝试覆盖从BasicProjectPaths 继承的所有方法(我使用 sbt.DefaultProject 作为我的项目描述符的超类)

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

但尽管路径覆盖,sbt 仍会创建“目标”文件夹。

【问题讨论】:

    标签: scala sbt


    【解决方案1】:

    似乎它应该使用主干中覆盖的 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吗?

    【讨论】:

      【解决方案2】:

      在 sbt 0.13.5 中,我找到了一种通过在 build.sbt 文件中重新分配目标来更改目标文件夹的方法:

      target := file("someotherParent") / "someotherSubdir"

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

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

      【讨论】:

        【解决方案3】:

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

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-03-06
          • 1970-01-01
          • 1970-01-01
          • 2016-06-03
          • 2013-04-21
          • 2012-07-06
          • 2010-09-08
          • 1970-01-01
          相关资源
          最近更新 更多