Removing “gen-java” prefix from auto-generated Java files with sbt-thrift in SBT 0.12?

拜拜、爱过 提交于 2019-12-11 05:45:30

问题


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

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

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

But the generated files goes to

gen-java/abc/xyz

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

abc/xyz

?


回答1:


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

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.

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


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.

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.



来源:https://stackoverflow.com/questions/21844241/removing-gen-java-prefix-from-auto-generated-java-files-with-sbt-thrift-in-sbt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!