Multi module project share file in another module

Hello everyone, I would like to extend thrift file which is defined in Module A, in the ModuleB. However as of now gradle is throwing error that the file in Module A not found. I tried adding source sets, it didn’t work. Could some one help me.
Main Project

  A
    --- src
         ---main
              --java
         -- thrift
  B
   ---src
       --main
           --java
        --thrift (Extends Thrift file in Module A)