Gradle Thrift Plugin Example

Please note:. While this question specifically raises the Gradle Thrift plugin , I think it's just a general Gradle question about whether some sort of battle-weary war veteran Gradle could help me.


I am new to Apache Thrift and only quasi-familiar with Gradle (2.4.x). I am trying to get the Gradle Thrift plugin to work, and I am facing a few problems, which are probably just spaces in my knowledge of Gradle.

Here is my sample project: thrifty

If you clone it and run ./gradlew compileThrift , you will see that it does exactly what Gradle Thrift README says. It generates a source in build/generated-sources/thrift/* .

I would like to compile and build this source. For the Java source that it generates, I would like to create a JAR library ... so what is the best way to do this? . Should I copy, say, build/generated-sources/thrift/gen-java/* to src/main/java , and then run build ?

+2
source share
1 answer

so you should just add a script to your collection

following:
 compileThrift { outputDir = file('src/generated/thrift') } sourceSets { main.java.srcDirs += 'src/generated/thrift/gen-java' } 

so the thrift plugin will be generated in a folder under src (I just prefer this so that the source code is in the assembly)

and then you can add these sources to the directories that the java plugin checks.

don't know about your additional python question

+2
source

Source: https://habr.com/ru/post/1242332/


All Articles