[英]Where should I put IDL files and generated code in Maven project?
I use standard Maven directory structure for my project 我为我的项目使用标准的Maven目录结构
- src
- main
- java
- resources
- webapp
- test
- java
- resources
- target
Now I want to use Thrift and gRPC but I don't know where should I put IDL files and where to put generated code? 现在,我想使用Thrift和gRPC,但是我不知道应该将IDL文件放在哪里以及将生成的代码放在哪里? Is there any "standard" or "best practices" suggestion?
是否有任何“标准”或“最佳做法”建议? Thank you for help!
谢谢你的帮助!
Generally sources generated by the build process go under the target/generated-sources
directory. 通常,由构建过程
target/generated-sources
位于target/generated-sources
目录下。
If you're generating the sources from a third party tool that is not, or cannot be, integrated with your build process, then you should stash it in something like generated/src/main
so that you know everything under it is generated. 如果您是通过未与构建过程集成的或无法与构建过程集成的第三方工具生成源的,则应将其存储在诸如
generated/src/main
以使您了解其下的所有内容。
In Intellij you can either use the maven default, or tell it explicitly where you have a generated source if you have it outside of the target
folder and in something like generated/src/main
在Intellij中,您既可以使用Maven默认值,也可以明确地告诉它在
target
文件夹之外以及在诸如generated/src/main
类的位置中有生成的源。
How to mark a directory in Intellij https://www.jetbrains.com/idea/help/configuring-content-roots.html#generated 如何在Intellij https://www.jetbrains.com/idea/help/configuring-content-roots.html#genic中标记目录
Content roots explained https://www.jetbrains.com/idea/help/content-root.html 内容根说明https://www.jetbrains.com/idea/help/content-root.html
How to configure IntelliJ IDEA and/or Maven to automatically add directories with Java source code generated using jaxb2-maven-plugin? 如何配置IntelliJ IDEA和/或Maven以使用jaxb2-maven-plugin生成的Java源代码自动添加目录?
you put the AIDL files in the 'exact' same package as you want your generated files to be (with respect to package), You put the AIDL files in your src/ tree and the 'generated' files will be in the 'generated' tree. 您将AIDL文件放在与要生成的文件完全相同的包中(相对于包),将AIDL文件放在src /树中,而“生成的”文件将放在“生成的”文件中树。
By doing this, the generated files will be in the 'org.whatever.project.services.aidl' package 这样,生成的文件将位于“ org.whatever.project.services.aidl”包中
Here is a good guide. 这是一个很好的指南。 http://developer.android.com/guide/components/aidl.html
http://developer.android.com/guide/components/aidl.html
Here is an example application: https://github.com/douglascraigschmidt/POSA-15/tree/502d9db2cbd90de3f4de0ed1bb74750004f47f06/ex/AcronymExpander/src/vandy/mooc/model/aidl 这是一个示例应用程序: https : //github.com/douglascraigschmidt/POSA-15/tree/502d9db2cbd90de3f4de0ed1bb74750004f47f06/ex/AcronymExpander/src/vandy/mooc/model/aidl
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.