Skip to content

Commit 618d8d1

Browse files
author
Hill Ma
committed
Fix Java build.
- Use latest API dependency versions. - Add missing YouTube Reporting API dependency. - Fix outdated API usage. - Use latest version of Maven Compiler Plugin.
1 parent a254a74 commit 618d8d1

4 files changed

Lines changed: 22 additions & 13 deletions

File tree

java/pom.xml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
<url>http://maven.apache.org</url>
1212

1313
<properties>
14-
<project.youtube.version>v3-rev107-1.18.0-rc</project.youtube.version>
15-
<project.youtube.analytics.version>v1-rev24-1.17.0-rc</project.youtube.analytics.version>
16-
<project.http.version>1.18.0-rc</project.http.version>
17-
<project.oauth.version>1.18.0-rc</project.oauth.version>
14+
<project.youtube.version>v3-rev179-1.22.0</project.youtube.version>
15+
<project.youtube.analytics.version>v1-rev63-1.22.0</project.youtube.analytics.version>
16+
<project.youtube.reporting.version>v1-rev10-1.22.0</project.youtube.reporting.version>
17+
<project.http.version>1.20.0</project.http.version>
18+
<project.oauth.version>1.20.0</project.oauth.version>
1819
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1920
</properties>
2021

@@ -34,13 +35,20 @@
3435
<version>${project.youtube.version}</version>
3536
</dependency>
3637

37-
<!-- Required for any code that makes calls to the Google Analytics API -->
38+
<!-- Required for any code that makes calls to the YouTube Analytics API -->
3839
<dependency>
3940
<groupId>com.google.apis</groupId>
4041
<artifactId>google-api-services-youtubeAnalytics</artifactId>
4142
<version>${project.youtube.analytics.version}</version>
4243
</dependency>
4344

45+
<!-- Required for any code that makes calls to the YouTube Reporting API -->
46+
<dependency>
47+
<groupId>com.google.apis</groupId>
48+
<artifactId>google-api-services-youtubereporting</artifactId>
49+
<version>${project.youtube.reporting.version}</version>
50+
</dependency>
51+
4452
<!-- This dependency is only used for the Topics API sample, which requires the Jackson JSON parser -->
4553
<dependency>
4654
<groupId>org.codehaus.jackson</groupId>
@@ -73,7 +81,7 @@
7381
<!-- Forces Maven to use Java 1.6 -->
7482
<plugin>
7583
<artifactId>maven-compiler-plugin</artifactId>
76-
<version>2.3.2</version>
84+
<version>3.6.0</version>
7785
<configuration>
7886
<source>1.6</source>
7987
<target>1.6</target>

java/src/main/java/com/google/api/services/samples/youtube/cmdline/data/CommentHandling.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import com.google.api.services.youtube.model.Comment;
2727
import com.google.api.services.youtube.model.CommentSnippet;
2828
import com.google.api.services.youtube.model.CommentThread;
29-
import com.google.api.services.youtube.model.V3CommentListResponse;
30-
import com.google.api.services.youtube.model.V3CommentThreadListResponse;
29+
import com.google.api.services.youtube.model.CommentListResponse;
30+
import com.google.api.services.youtube.model.CommentThreadListResponse;
3131
import com.google.common.collect.Lists;
3232

3333
/**
@@ -86,7 +86,7 @@ public static void main(String[] args) {
8686

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

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

java/src/main/java/com/google/api/services/samples/youtube/cmdline/data/CommentThreads.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import com.google.api.services.youtube.model.CommentSnippet;
2828
import com.google.api.services.youtube.model.CommentThread;
2929
import com.google.api.services.youtube.model.CommentThreadSnippet;
30-
import com.google.api.services.youtube.model.V3CommentThreadListResponse;
30+
import com.google.api.services.youtube.model.CommentThreadListResponse;
3131
import com.google.common.collect.Lists;
3232

3333
/**
@@ -135,7 +135,7 @@ public static void main(String[] args) {
135135

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

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

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

java/src/main/java/com/google/api/services/samples/youtube/cmdline/reporting/RetrieveReports.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import com.google.api.client.auth.oauth2.Credential;
1818
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
19+
import com.google.api.client.http.GenericUrl;
1920
import com.google.api.services.samples.youtube.cmdline.Auth;
2021
import com.google.api.services.youtubereporting.YouTubeReporting;
2122
import com.google.api.services.youtubereporting.YouTubeReporting.Media.Download;

0 commit comments

Comments
 (0)