简体   繁体   English

无法在Java项目上添加Thrift支持

[英]Can't add Thrift support on a Java project

So I am trying to build a client server application, using Java for my Client and C# for my server. 因此,我试图构建一个客户端服务器应用程序,对客户端使用Java,对服务器使用C#。 I made a Gradle project for my Java client, and I can't add Thrift to it no matter what I try. 我为Java客户端创建了一个Gradle项目,无论尝试如何,都无法在其中添加Thrift。

This is how my gradle looks. 这就是我的摇篮的样子。

plugins {
    id "org.jruyi.thrift" version "0.4.0"
}

group 'com.artyomska.thrift'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8


repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

Even after I built and assembled this Gradle, the following imports won't be recognized: 即使在我组装并组装了此Gradle之后,也无法识别以下进口:

import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;

I have tried to use buildscript on the build.gradle file instead of plugins, I have tried to Synchronize the Gradle file with the project, I have tried Install Thrift Support 0.9.6 from Settings-Plugins, I have also added the Thrift as a framework to my project and I also tried to Invalidate the caches and restart, and still nothing works. 我尝试在build.gradle文件而不是插件上使用buildscript,我尝试将Gradle文件与项目同步,我尝试从Settings-Plugins安装Thrift支持0.9.6,我还添加了Thrift作为我的项目的框架,并且我还尝试使缓存无效并重新启动,但仍然没有任何效果。 I made 3 new projects since I thought maybe my folders or the Gradle for that project is corrupt, but nothing was resolved. 我创建了3个新项目,因为我认为我的文件夹或该项目的Gradle损坏了,但是没有解决。

How can I make my Gradle project support Thrift, and those imports to work in it? 我怎样才能使我的Gradle项目支持Thrift,并使那些导入工作呢? I am using W10 with IntelliJ Idea Ultimate 2017.1 (last version) 我正在使用W10和IntelliJ Idea Ultimate 2017.1(最新版本)

Looks like you forget to add compile dependency to your project 好像您忘记为项目添加编译依赖项

dependencies {
  compile group: 'org.apache.thrift', name: 'libthrift', version: '0.9.3'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM