简体   繁体   English

我应该将IDL文件和生成的代码放在Maven项目的哪里?

[英]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 /树中,而“生成的”文件将放在“生成的”文件中树。

  • src src
    • main 主要
      • java 爪哇
        • org 组织
          • whatever 随你
            • project 项目
              • services 服务
                • aidl 艾德尔
                  • POJO2.java POJO2.java
                  • IRemoteService.aidl IRemoteService.aidl
                  • IRemoteServiceCallback.aidl IRemoteServiceCallback.aidl
                  • POJO1.aidl POJO1.aidl

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.

相关问题 我应该在maven项目的路径中放置不被视为资源的配置文件 - Where in maven project's path should I put configuration files that are not considered resources 我应该将主要实现放在多模块Maven项目中的哪个位置? - Where should I put the main implementation in a multi module Maven project? 我应该在Maven中的Web(WAR)项目中添加Java文件? - Where should I add Java files in web (WAR) project in Maven? Eclipse动态Web项目:我应该在哪里放置资源文件 - Eclipse dynamic web project : where should I put resource files 我应该将 SQL 文件放在我的 Java 项目中的什么位置? - Where should I put the SQL files in my Java project? 我应该在web应用程序(maven项目)中将java.util.logging的logging.properties文件放在哪里? - Where should I put logging.properties file for java.util.logging in web application (maven project)? 在多模块Maven项目中应将共享测试实用程序放在哪里? - Where should I put shared testing utilities in a multi-module Maven project? 我应该在哪里将配置文件放在Web服务中 - where should i put the configuration files in a webservice 我应该将代码放在Java的哪里? - Where should I put my code in java? 我应该在哪里放置初始化代码? - Where should I put my initialisation code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM