Tối thiểu, bạn có thể định cấu hình thư mục nguồn cơ sở trong phạm vi Test
và Compile
, sau đó định cấu hình thư mục tài nguyên trong phạm vi Compile
. Cài đặt đó sẽ chính xác trong phạm vi Test
vì theo mặc định, cài đặt đó tương ứng với sourceDirectory
. Tương tự, cài đặt scala-source
và java-source
sẽ chính xác.
sourceDirectory in Compile <<= baseDirectory(_/"src")
sourceDirectory in Test <<= baseDirectory(_/"test")
resourceDirectory in Compile <<= baseDirectory(_/"resources")
Để thấy điều này trong hành động:
> 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
Bạn có thể kiểm tra các mối quan hệ giữa các thiết lập trong vỏ với inspect
; hoặc bằng cách duyệt qua source of SBT