1

我正在使用以下代码尝试从我使用 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();

当我执行“mvn package”时,出现以下错误:

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>

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

4

0 回答 0