如何在sbt中编译单个文件 [英] how to compile single file in sbt

查看:29
本文介绍了如何在sbt中编译单个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一些重构,使编译器暂时在几个文件中给出错误.我想一一使用它们(从常见的依赖项开始),并且需要一些工具来检查修改是否正确.

I'm doing some refactoring that made compiler temporally give errors in several files. I'd like to work with them one by one (starting with common dependencies) and need some tool to check if modification is correct.

sbt compile 很不方便,因为它给出了太多的错误并且花费了很多时间来编译没有好处的东西.

sbt compile is inconvenient because it gives too many errors and spends much time for compiling things that have no good.

我正在寻找一种使用 sbt 编译单个文件的方法或一种提取 sbt 侧库定义以将它们传递给普通 scalac 编译器的方法

I'm searching for a way to compile single file with sbt or a method for extracting sbt side libraries definition to pass them to a normal scalac compiler

有一个类似的话题:How to compile just some files withsbt? 原来是源代码错误讨论,而不是 sbt 功能披露.

There was a similar topic: How to compile just some files with sbt? that turned out to be source code error discussion rather that sbt functionality disclosure.

推荐答案

您可以在 build.sbt 中添加以下行:

You could add the following line to build.sbt:

sources in Compile <<= (sources in Compile).map(_ filter(_.name == "Particular.scala"))

然后修复Particular.scala,然后编辑build.sbt并输入下一个源文件的名称.如果保持 sbt 控制台打开,reload 会在修改后重新读取 .sbt 文件.

Then fix Particular.scala, then edit build.sbt and put the name of the next source file. If you keep the sbt console open, reload will re-read the .sbt file after you modify it.

这篇关于如何在sbt中编译单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆