删除“gen-java"SBT 0.12 中带有 sbt-thrift 的自动生成的 Java 文件的前缀? [英] Removing "gen-java" prefix from auto-generated Java files with sbt-thrift in SBT 0.12?

查看:28
本文介绍了删除“gen-java"SBT 0.12 中带有 sbt-thrift 的自动生成的 Java 文件的前缀?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 sbt-thrift 插件 0.6 和 SBT0.12.

I am working with sbt-thrift plugin 0.6 and SBT 0.12.

在我的 thrift 文件中,我提到了如下命名空间.

In my thrift files I have mentioned the namespace as below.

namespace java abc.xyz
//some 
//thrift 
//codes

但是生成的文件去

gen-java/abc/xyz

(gen-java 前缀是自动添加的).我怎样才能把它改成

(gen-java prefix is added automatically). How can I change this into

abc/xyz

?

推荐答案

有一个 -out <outdir> 选项可以做到这一点.在您的情况下,指定当前文件夹 . 作为 outdir.

There is an -out <outdir> option which does exactly that. In your case, specify the current folder . as the outdir.

请注意,与自动生成的 gen-* 文件夹不同,outdir 目录必须存在.换句话说,您必须确保在调用 Thrift 编译器之前创建了该文件夹.

Note that, unlike with the automatically generated gen-* folders, the outdir directory must exist. In other words, you have to make sure the folder is created before calling the Thrift compiler.

--help 选项提供有关所有其他开关的更多信息.

The --help option gives more information about all the other switches.

关于SBT,如果https://github.com/bigtoast/sbt-thrift 是真的,那么您应该联系该软件的作者以添加选项 thriftJavaOutputDir 因为它似乎丢失了.

Regarding SBT, if the information on https://github.com/bigtoast/sbt-thrift is true, then you should contact the author of that software to add the option thriftJavaOutputDir as it seems missing.

顺便说一句,这个问题看起来很像 如何在 SBT 中更改 sbt-thrift 插件的默认设置? 我建议不要在 SO 上问一万份类似的问题.

BTW, the question looks very much like a duplicate of How to change default settings of sbt-thrift plugin in SBT? I would recommend to NOT ask ten thousand copies of similar questions on SO.

这篇关于删除“gen-java"SBT 0.12 中带有 sbt-thrift 的自动生成的 Java 文件的前缀?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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