Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.pamalyshev:thrift-gradle-plugin:v0.3.3'
}
dependencies {
implementation("com.github.pamalyshev:thrift-gradle-plugin:v0.3.3")
}
<dependency>
<groupId>com.github.pamalyshev</groupId>
<artifactId>thrift-gradle-plugin</artifactId>
<version>v0.3.3</version>
</dependency>
libraryDependencies += "com.github.pamalyshev" % "thrift-gradle-plugin" % "v0.3.3"
:dependencies [[com.github.pamalyshev/thrift-gradle-plugin "v0.3.3"]]
Gradle Thrift Plugin uses thrift compiler to compile Thrift IDL files.
To use this plugin, add the following to your build script.
buildscript {
repositories {
maven {
url 'https://jitpack.io'
}
}
dependencies {
classpath "com.github.pamalyshev:thrift-gradle-plugin:v0.3.3"
}
}
apply plugin: "org.jruyi.thrift"
See the examples/test2 directory for a very simple example.
None.
The Thrift plugin adds compileThrift task which compiles Thrift IDL files using thrift compiler.
Task Property | Type | Default Value ------------------|---------------------|--------------------------------------------------- thriftExecutable | String | thrift sourceDir | File | src/main/thrift outputDir | File | buildDir/generated-sources/thrift thriftFiles | Set<File> | [] includeDirs | Set<File> | [] generators | Map<String, String> | ['java':''] if JavaPlugin is applied, otherwise [] nowarn | boolean | false strict | boolean | false verbose | boolean | false recurse | boolean | false debug | boolean | false allowNegKeys | boolean | false allow64bitsConsts | boolean | false createGenFolder | boolean | true
If createGenFolder is set to false, no gen-* folder will be created.
If thriftFiles is empty then all .thrift files under sourceDir will be compiled. If thriftFiles is not empty then only files in thriftFiles will be compiled. Relative paths are resolved against sourceDir.
compileThrift {
recurse true
/* If you need to compile only specified files use thriftFile method */
//thriftFile 'dir/file1.thrift'
//thriftFile 'dir/file2.thrift'
generator 'html'
generator 'java', 'private-members'
}
When JavaPlugin is applied, generator 'java' will be created and the generated java code will be added to Java source automatically.
Ubuntu 14.04 (Trusty) provides Thrift 0.9.0. If this version fits your requirements, you can use the following .travis.yml configuration file:
language: java
dist: trusty
sudo: required
before_install:
- sudo apt-get install thrift-compiler
script:
- ./gradlew check
- ./gradlew assemble
Gradle Thrift Plugin is licensed under the Apache License, Version 2.0.