尝试编译时,YouTube API会出错

时间:2012-11-14 05:28:20

标签: youtube-api

我正在使用以下代码尝试从我使用maven构建的项目中检索来自YouTube API的供稿列表。

YouTubeService service = new YouTubeService("dev","123456");
String feedUrl = "http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed";
VideoFeed videofeed = service.getFeed(new URL(feedUrl), VideoFeed.class);
List<VideoEntry> videos = videofeed.getEntries();

当我做&#34; mvn package&#34;我收到以下错误:

found   : com.google.gdata.data.IFeed
required: com.google.gdata.data.youtube.VideoFeed

我做错了什么吗? 我的导入如下:

import com.google.gdata.client.youtube.*;
import com.google.gdata.client.*;
import com.google.gdata.data.*;
import com.google.gdata.data.youtube.*;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;
import com.google.gdata.data.media.*;
import com.google.gdata.data.media.mediarss.*;

POM文件。我使用以下方法添加了artifactId:

mvn install:install-file -DgroupId=youtube-12 -DartifactId=youtube-12 -Dversion=1.47.1 -Dpackaging=jar -Dfile=/usr/share/gdata/java/lib/gdata-calendar-2.0.jar 

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>3.0.5.RELEASE</version>
        <optional>false</optional>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>youtube-1</groupId>
      <artifactId>youtube-1</artifactId>
      <version>1.47.1</version>
    </dependency>

    <dependency>
      <groupId>youtube-2</groupId>
      <artifactId>youtube-2</artifactId>
      <version>1.47.1</version>
    </dependency>

    <dependency>
      <groupId>youtube-3</groupId>
      <artifactId>youtube-3</artifactId>
      <version>1.47.1</version>
    </dependency>
    <dependency>
     <groupId>javax.mail</groupId>
     <artifactId>mail</artifactId>
     <version>1.4.5</version>
    </dependency>

    <dependency>
     <groupId>com.google.guava</groupId>
     <artifactId>guava</artifactId>
     <version>12.0</version>
    </dependency>
</dependencies>

知道我可能做错了什么吗?谢谢。

0 个答案:

没有答案