Search code examples
javatwitter4j

Why does my twitter4j maven dependency not include TwitterStreamFactory?


I've been using twitter4j for months, doing simple getUserTimeline(), after creating TwitterFactory and Twitter instance with OAuth in Configuration. Works great.

But now I'd like to use the Streaming feature, TwitterStreamFactory. It is not included in my external library that maven is managing. I've included twitter4j via maven like they say, like so:

<dependency>
    <groupId>org.twitter4j</groupId>
    <artifactId>twitter4j-core</artifactId>
    <version>[4.0,)</version>
</dependency>

I also tried changing the version to 4.0.7. The docs say TwitterStreamFactory is there since version 2.1.0, so why isn't it in my twitter4j library?

I'm viewing all the dependencies/external libraries via Intellij's view of them in the project. I don't see any other versions, or dependency conflicts.


Solution

  • First, it is in twitter4j as of version 4.0.7.

    But as you can see, it is part of the twitter4j-stream artifact. You'll want to use the twitter4j-stream Maven artifact instead.