【问题标题】:How do I execute Scrooge from commandline?如何从命令行执行 Scrooge?
【发布时间】:2014-08-25 02:05:11
【问题描述】:

我能够在我的 SBT 项目中包含 scrooge(我的 plugins.sbt 中的 scrooge-sbt-plugin 以及我的 build.sbt 中的库依赖项),但我无法弄清楚如何从此处列出的命令行执行 scrooge http://twitter.github.io/scrooge/CommandLine.html

【问题讨论】:

  • 您是否有不想使用该插件的原因?它比 CLI 得到更好的支持。
  • 我打算主要使用这个插件。我只是想快速查看为 SBT 项目之外的一些 thrift 文件生成的代码。我想我会问,因为我在上面的链接中看到了有关命令行选项的信息,但没有关于如何让它工作的信息,而且谷歌没有显示任何有意义的信息。
  • 我已提交an issue about this。与此同时,您可以获取 Scrooge 源并将 sbt "project scrooge-generator" "runMain com.twitter.scrooge.Main ..." 指向您的 Thrift 文件。

标签: scala thrift scrooge


【解决方案1】:

聚会有点晚了。

@partycoder 确实是对的,但更多可能对这些人有所帮助 像我这样的人不太确定。

假设您的 *.thrift 文件位于 src/main/thrift 中,只需运行 sbt scrooge-gen 将获取文件并将它们存放在 target/src_managed/ 中。

如果您的*.thrift 文件不在src/main/thrift 中,也许在src/main/resources/thrift 中,您可以使用以下示例在您的build.sbt 中设置scroogeThriftSourceFolder

scroogeThriftSourceFolder in Compile <<= baseDirectory {
  base => base / "src/main/resources/thrift/"
}

这个设置和其他设置可以在here找到。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-05-05
    • 2012-07-15
    • 2017-07-04
    • 1970-01-01
    • 1970-01-01
    • 2013-11-21
    • 2010-11-19
    相关资源
    最近更新 更多