gpt4 book ai didi

scala - 在 SBT 0.10.x 中更改项目布局

转载 作者:行者123 更新时间:2023-12-04 00:50:57 24 4
gpt4 key购买 nike

我觉得自己像个白痴,但我无法使用 SBT 0.10.x 更改我的项目布局。在我的 sbt 0.7.x 项目中,我添加了以下几行:

override def mainScalaSourcePath = "src" / "scala"
override def testScalaSourcePath = "test" / "scala"
override def mainResourcesPath = "resources"

override def mainJavaSourcePath = "src" / "java"
override def testJavaSourcePath = "test" / "java"
override def testResourcesPath = "test" / "resources"

0.10.x 中的等价物是什么?

最佳答案

至少,您可以在 Test 中配置基本源目录。和 Compile范围,然后在 Compile 中配置资源目录范围。该设置在 Test 中是正确的范围因为默认情况下它是相对于 sourceDirectory .同样,scala-sourcejava-source设置将是正确的。

sourceDirectory in Compile <<= baseDirectory(_ / "src")

sourceDirectory in Test <<= baseDirectory(_ / "test")

resourceDirectory in Compile <<= baseDirectory(_ / "resources")

要查看此操作:
> set sourceDirectory in Compile <<= baseDirectory(_ / "src")
[info] Reapplying settings...
[info] Set current project to default-fcf187 (in build file:/C:/temp/)

> set sourceDirectory in Test <<= baseDirectory(_ / "test")
[info] Reapplying settings...
[info] Set current project to default-fcf187 (in build file:/C:/temp/)

> set resourceDirectory in Compile <<= baseDirectory(_ / "resources")
[info] Reapplying settings...
[info] Set current project to default-fcf187 (in build file:/C:/temp/)

> show test:resource-directory
[info] C:\temp\test\resources
> show compile:resource-directory
[info] C:\temp\resources
> show test:scala-source
[info] C:\temp\test\scala
> show test:java-source
[info] C:\temp\test\java
> show compile:java-source
[info] C:\temp\src\java
> show test:java-source
[info] C:\temp\test\java

您可以使用 inspect 检查 shell 中设置之间的关系。 ;或浏览 source of SBT

关于scala - 在 SBT 0.10.x 中更改项目布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7081194/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com