问题
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