Skip to content

Commit

Permalink
Fix Java build.
Browse files Browse the repository at this point in the history
- Use latest API dependency versions.
- Add missing YouTube Reporting API dependency.
- Fix outdated API usage.
- Use latest version of Maven Compiler Plugin.
  • Loading branch information
Hill Ma committed Nov 4, 2016
1 parent a254a74 commit 618d8d1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
20 changes: 14 additions & 6 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
<url>http://maven.apache.org</url>

<properties>
<project.youtube.version>v3-rev107-1.18.0-rc</project.youtube.version>
<project.youtube.analytics.version>v1-rev24-1.17.0-rc</project.youtube.analytics.version>
<project.http.version>1.18.0-rc</project.http.version>
<project.oauth.version>1.18.0-rc</project.oauth.version>
<project.youtube.version>v3-rev179-1.22.0</project.youtube.version>
<project.youtube.analytics.version>v1-rev63-1.22.0</project.youtube.analytics.version>
<project.youtube.reporting.version>v1-rev10-1.22.0</project.youtube.reporting.version>
<project.http.version>1.20.0</project.http.version>
<project.oauth.version>1.20.0</project.oauth.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand All @@ -34,13 +35,20 @@
<version>${project.youtube.version}</version>
</dependency>

<!-- Required for any code that makes calls to the Google Analytics API -->
<!-- Required for any code that makes calls to the YouTube Analytics API -->
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-youtubeAnalytics</artifactId>
<version>${project.youtube.analytics.version}</version>
</dependency>

<!-- Required for any code that makes calls to the YouTube Reporting API -->
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-youtubereporting</artifactId>
<version>${project.youtube.reporting.version}</version>
</dependency>

<!-- This dependency is only used for the Topics API sample, which requires the Jackson JSON parser -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
Expand Down Expand Up @@ -73,7 +81,7 @@
<!-- Forces Maven to use Java 1.6 -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>3.6.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import com.google.api.services.youtube.model.Comment;
import com.google.api.services.youtube.model.CommentSnippet;
import com.google.api.services.youtube.model.CommentThread;
import com.google.api.services.youtube.model.V3CommentListResponse;
import com.google.api.services.youtube.model.V3CommentThreadListResponse;
import com.google.api.services.youtube.model.CommentListResponse;
import com.google.api.services.youtube.model.CommentThreadListResponse;
import com.google.common.collect.Lists;

/**
Expand Down Expand Up @@ -86,7 +86,7 @@ public static void main(String[] args) {

// Call the YouTube Data API's commentThreads.list method to
// retrieve video comment threads.
V3CommentThreadListResponse videoCommentsListResponse = youtube.commentThreads()
CommentThreadListResponse videoCommentsListResponse = youtube.commentThreads()
.list("snippet").setVideoId(videoId).setTextFormat("plainText").execute();
List<CommentThread> videoComments = videoCommentsListResponse.getItems();

Expand Down Expand Up @@ -138,7 +138,7 @@ public static void main(String[] args) {
// Call the YouTube Data API's comments.list method to retrieve
// existing comment
// replies.
V3CommentListResponse commentsListResponse = youtube.comments().list("snippet")
CommentListResponse commentsListResponse = youtube.comments().list("snippet")
.setParentId(parentId).setTextFormat("plainText").execute();
List<Comment> comments = commentsListResponse.getItems();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.google.api.services.youtube.model.CommentSnippet;
import com.google.api.services.youtube.model.CommentThread;
import com.google.api.services.youtube.model.CommentThreadSnippet;
import com.google.api.services.youtube.model.V3CommentThreadListResponse;
import com.google.api.services.youtube.model.CommentThreadListResponse;
import com.google.common.collect.Lists;

/**
Expand Down Expand Up @@ -135,7 +135,7 @@ public static void main(String[] args) {

// Call the YouTube Data API's commentThreads.list method to
// retrieve video comment threads.
V3CommentThreadListResponse videoCommentsListResponse = youtube.commentThreads()
CommentThreadListResponse videoCommentsListResponse = youtube.commentThreads()
.list("snippet").setVideoId(videoId).setTextFormat("plainText").execute();
List<CommentThread> videoComments = videoCommentsListResponse.getItems();

Expand Down Expand Up @@ -172,7 +172,7 @@ public static void main(String[] args) {

// Call the YouTube Data API's commentThreads.list method to
// retrieve channel comment threads.
V3CommentThreadListResponse channelCommentsListResponse = youtube.commentThreads()
CommentThreadListResponse channelCommentsListResponse = youtube.commentThreads()
.list("snippet").setChannelId(channelId).setTextFormat("plainText").execute();
List<CommentThread> channelComments = channelCommentsListResponse.getItems();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
import com.google.api.client.http.GenericUrl;
import com.google.api.services.samples.youtube.cmdline.Auth;
import com.google.api.services.youtubereporting.YouTubeReporting;
import com.google.api.services.youtubereporting.YouTubeReporting.Media.Download;
Expand Down

0 comments on commit 618d8d1

Please sign in to comment.