use*_*400 5 java thrift intellij-idea gradle
我使用thrift并在构建目录(build/generated-sources/thrift/<package name>/<class>)
下生成一些源java文件(接口)但在我的下面src/main/java
我的类具有与生成的java文件相同的包定义,我的类也实现了thrift生成的接口所以我怎么能在我的build.gradle中配置它,所以它适用于i ntelliJ以及构建
plugins {
id "org.jruyi.thrift" version "0.3.1"
}
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: "org.jruyi.thrift"
group 'com.hello'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.5
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.apache.thrift', name: 'libthrift', version:'0.9.3'
compile 'com.datastax.cassandra:cassandra-driver-core:3.0.0'
compile 'com.datastax.cassandra:cassandra-driver-mapping:3.0.0'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
compileThrift {
thriftExecutable "/usr/local/hello/bin/thrift"
sourceDir "src/main/thrift"
createGenFolder false
}
task thrift(type: Exec) {
commandLine '/usr/local/hello/bin/thrift'
}
compileJava {
dependsOn 'compileThrift'
Run Code Online (Sandbox Code Playgroud)
小智 4
gradle 构建应该会自动运行。要使其在 Intellij 上运行,请尝试将以下内容添加到您的 build.gradle 中。
idea.module.sourceDirs += file("$buildDir/generated-sources/thrift")
Run Code Online (Sandbox Code Playgroud)
不要忘记刷新您的 gradle 项目。
归档时间: |
|
查看次数: |
2812 次 |
最近记录: |