0

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!

Kevin
  • 1,403
  • 4
  • 18
  • 34

2 Answers2

1

Generally sources generated by the build process go under the target/generated-sources directory.

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.

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

How to mark a directory in Intellij https://www.jetbrains.com/idea/help/configuring-content-roots.html#generated

Content roots explained 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?

Community
  • 1
  • 1
Jazzepi
  • 5,259
  • 11
  • 55
  • 81
1

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

mawalker
  • 2,072
  • 2
  • 22
  • 34
  • I think you right, it seems good to put IDL files in the same package with generated codes – Kevin Dec 27 '15 at 04:33