Search code examples
javamaventwittertwitter4j

Updating Twitter4j in a Java project


I have an application that streams Twitter data using Twitter4j. In Maven Dependencies, I've got the 4.0.2 version, but I want to update to the 4.0.4. How do I do that? In Configure Build Path it is not possible to edit the selection of the jar file. Here are the two jars that I want to update

The menu on the right is not clickable


Solution

  • This is the major advantage of using Maven, that it fetches the required jars and caches it for your further usage.

    You don't have to download the updated JAR, just update the version number of the JAR in your Maven POM file and do a clean and rebuild.

    When you do that, Maven will check your local repository (cache) and, if the jar hasn't already been downloaded, it will go to the maven repositories, find a copy, and download it (this is assuming you didn't do an offline build!), then it will use that copy to do your new build with.

    <dependency>
        <groupId>org.twitter4j</groupId>  
        <artifactId>twitter4j-core</artifactId>
        <version>4.0.4</version>
    </dependency>
    

    Hope that this helps!