问题标签 [sbt-0.13]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1051 浏览

scala - sbt 0.13.16 - 如何在 build.sbt 文件中 println(systemProperty)?

我正在将 Build.scala 文件迁移到 build.sbt 文件。

在 Build.scala 文件中,有一些 print 语句可以打印出 Build.scala 文件主体中定义的 vals(字符串类型)。

项目/Build.scala:

如何将这些打印语句迁移到 build.sbt 文件?

0 投票
1 回答
63 浏览

scala - sbt 0.13.16 - 如何自定义触发执行(文件监视)

现在,我所做的大部分更改是配置文件和 build.sbt 文件。话虽如此,当我触摸这些文件时,我仍然想触发执行(例如编译、测试、重新加载等)。如何自定义 sbt 触发执行以在项目中的任何文件被修改时执行?

https://www.scala-sbt.org/0.13/docs/Howto-Triggered.html

0 投票
1 回答
178 浏览

scala - How do I get the last commit programmatically in Java code? Jenkins / sbt

I started writing a little tool that basically can do something (ex. compile or test code) and then send an email if it fails.

https://github.com/JohnReedLOL/EmailTestingBot

I want to add a feature where this tool can programmatically look at the last commit in the working directory, look at the author of the commit, extract their email, and then email that person whether their commit resulted in a pass or a failure.

For example, I want it to do something like: Git: See my last commit

Where the email basically says:

Subject: Test Results

Message: All your tests passed in dev for commit 0e39756383662573.

Does Jenkins provide this functionality already? I want to make my setup email the person who put in the most recent commit.

Also, is there a way I can obtain the email of the author of the most recent commit programmatically (ex. perhaps with http://www.eclipse.org/jgit/ or http://javagit.sourceforge.net )?

I don't really care how I get email notifications - I just want them and I can't use TravisCI.

0 投票
1 回答
227 浏览

scala - sbt 如何在 sbt 任务中获得编译结果(成功/失败)

我正在尝试编写一个 sbt 任务来检查代码编译是成功还是失败,并根据该信息执行某些操作。到目前为止,我有这个:

https://github.com/JohnReedLOL/WeirdSbtBug/blob/894f497567477619b4150de92c6bb2c146a1b615/build.sbt#L46

当编译失败时,它打印出:

其中包含字符串“编译失败”。我可以检查该字符串是否存在,并根据结果执行某些操作。

例子:

但这看起来有点脆弱。有没有更好的方法来做到这一点?

ps 在测试monitorTask的过程中,遇到了这个bug:https ://github.com/sbt/sbt/issues/4444

0 投票
0 回答
293 浏览

scala - SBT - 如何在同一个项目中混合/创建单独的 Scala 2.11 和 Scala 2.12 文件夹?

我有一个 sbt 项目,其中包含已弃用的库(例如 Spray、预发布宏天堂等),我无法升级到 Scala 2.12。它现在与 Scala 2.11.8 一起编译。我想通过创建一个名为“2.12”的文件夹和一个名为“2.11”的文件夹并将弃用的 2.11 代码放在“2.11”文件夹中,继续使用非弃用的库(例如 Akka HTTP、最新的 Scala 宏等)进行开发并在“2.12”文件夹中继续开发。“2.12”文件夹中的代码可以与Scala 2.11 和Scala 2.12 交叉编译,但“2.11”文件夹中的代码只能与Scala 2.11 一起编译。我希望能够在同一个项目中混合不推荐使用的代码和不推荐使用的代码,至少一开始是这样,然后逐渐将内容移到“2.12”文件夹中。我如何用 sbt 做到这一点?

现在该项目使用 sbt 0.13,它不会用 sbt 1.X 编译,但是如果我清理/修复 Build.scala 文件并将其转换为 build.sbt 文件,我想我将能够升级从 0.13 到 1.X

可以通过以下方式更改默认的 Scala 源目录:https ://www.scala-sbt.org/1.0/docs/Howto-Customizing-Paths.html