使用Twitter Streaming Api时遇到java错误

时间:2016-03-14 20:45:05

标签: java maven twitter scribe twitter-streaming-api

导入错误

import statements not working

控制台错误

无法在项目streamingTwitter上执行目标:无法解析项目com.mycompany的依赖项:streamingTwitter:jar:1.0-SNAPSHOT:无法解析以下工件:org.scribe:scribe:jar:1.3.4,org .spark:spark:jar:0.9.9.4-SNAPSHOT:找不到org.scribe:scribe:jar:http://maven.springframework.org/release中的1.3.4被缓存在本地存储库中,直到更新间隔时才会重新尝试解析spring-maven-release已经过去或强制更新 - > [帮助1]

的pom.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.mycompany</groupId>
        <artifactId>streamingTwitter</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>
        <properties>
            <project.build.sourceEncoding>UTF-        8</project.build.sourceEncoding>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
        </properties>
        <repositories>
            <repository>
                <id>spring-maven-release</id>
                <name>Spring Maven Release Repository</name>
                <url>http://maven.springframework.org/release</url>
            </repository>
        </repositories>
        <dependencies>

                    <dependency>
                <groupId>com.github.scribejava</groupId>
                <artifactId>scribejava-apis</artifactId>
                <version>2.4.0</version>
            </dependency>
            <dependency>
                <groupId>org.scribe</groupId>
                <artifactId>scribe</artifactId>
                <version>1.3.4</version>
            </dependency>
            <dependency>
              <groupId>org.spark</groupId>
              <artifactId>spark</artifactId>
              <version>0.9.9.4-SNAPSHOT</version>
            </dependency>
        </dependencies>
    </project>

我遵循本教程 http://www.jeffkuchta.com/Tutorial/2013/02/21/java--twitter-public-streams-with-support-from-heroku-spark--oauth/。 感谢您的帮助,在来这里之前浪费了很多时间。

1 个答案:

答案 0 :(得分:2)

由于某些原因,版本order by case when state = 'CRITICAL' then 0 when state = 'WARNING' then 1 when state = 'UPDATE' then 2 when state = 'OFF' then 3 when state = 'ON' then 4 end 不在Maven repository中,请尝试使用更高版本,例如:1.3.4

自撰写文章以来,抄写员已经走了很长的路。我建议你在ScribeJava home on Github熟悉它。所有示例都是here,包括Twitter一个。

祝你好运!