0

My goal is to use the hosebird client provided by Twitter to stream tweets in my Grails project.

I'm really not sure how I will approach this, but I first tried including it in the dependencies in my BuildConfig.groovy like this:

dependencies {
    compile 'com.twitter:hbc-core:2.2.0'
}

And then, when I tried to mimic the example code, FilterStreamExample.java, in my TwitterService.groovy, GGTS (the IDE) just shows me errors as I write these lines of code:

import com.google.common.collect.Lists
import com.twitter.hbc.ClientBuilder
import com.twitter.hbc.core.Client
import com.twitter.hbc.core.Constants
import com.twitter.hbc.core.endpoint.StatusesFilterEndpoint
import com.twitter.hbc.core.processor.StringDelimitedProcessor
import com.twitter.hbc.httpclient.auth.Authentication
import com.twitter.hbc.httpclient.auth.OAuth1

Obviously, this makes me unable to run the code because of the compile time error. It just tells that the error is something "Groovy was unable to resolve".

Can you tell what am I missing?

Is it just a groovy syntax error that I'm not noticing? I'm new to Groovy so please bear with me.

OR

Is the problem here is in the inclusion of the library in the dependencies?

My first aim is to be able to use the library this way as I have told it above (the BuildConfig way) before trying to make jars and put it in the src/java. Who knows, the compile time error will appear too. I just want to know if the current obstacle in the approach I did is easy to fix.

4

1 回答 1

0

GGTS 和 STS 不解析BuildConfig.groovy- 它们从 Grails 获取所有类路径信息。当您BuildConfig.groovy使用新的插件或 jar 依赖项进行更新时,右键单击左侧树中的项目节点并选择Grails Tools| Refresh DependenciesGGTS 将根据应用程序的当前状态重建其类路径。

于 2015-01-04T20:02:40.493 回答