开发者

Changing sbt project's directory layout

开发者 https://www.devze.com 2023-01-18 03:00 出处:网络
According to sbt tutorial on changing paths I\'m trying to change \"target\" output directory to \"someother\"

According to sbt tutorial on changing paths I'm trying to change "target" output directory to "someother"

override def outputDirectoryName = "someother"

Everything goes fine except one: sbt automatically creates target directory with ".history" file inside. Why sbt does this when it supposed do create only "someother" dir ? I tryied to override all methods that are inherited from Bas开发者_开发技巧icProjectPaths (I use sbt.DefaultProject as superclass of my project descriptor)

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

But sbt creates "target" folder in spite of paths overriding.


It certainly seems that it should use the overridden outputDirectoryName in trunk...

/** 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).

It may have been different in a previous version. Have you considered raising a new bug?


In sbt 0.13.5, I found a way to change the target folder by just re-assigning target in the build.sbt file:

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

This only modifies the directory for the built classes and artifacts, however, the .history file is always in the project root directory.

Unfortunately, some other plugins (xsbt-web-plugin) seem to have problems with that - running the webapp via SBT console produced weird errors, when I switched back to the standard directory layout, these problems disappeared.


A better way to achieve my goals (of all JARS in one directory, whose names contains the JAVA-VM-version) seems to be to specify an appropriate target for publishing - there are less restrictions on "sbt publish", and other plugins are not disturbed by a different directory layout.

0

精彩评论

暂无评论...
验证码 换一张
取 消