Search code examples
javamavenprotocol-buffersthrift

Where should I put IDL files and generated code in Maven project?


I use standard Maven directory structure for my project

- 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? Is there any "standard" or "best practices" suggestion? Thank you for help!


Solution

  • 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.

    • src
      • main
        • java
          • org
            • whatever
              • project
                • services
                  • aidl
                    • POJO2.java
                    • IRemoteService.aidl
                    • IRemoteServiceCallback.aidl
                    • POJO1.aidl

    By doing this, the generated files will be in the 'org.whatever.project.services.aidl' package

    Here is a good guide. 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