我希望通过java api(v3)访问google-analytics。要登录,我想使用OAuth2。我找到了一个java示例,它展示了如何做到这一点。不幸的是我无法编译我复制的代码。似乎我对FileCredentialStore
没有依赖性。我的Pom看起来像这样:
<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>de.import.google</groupId>
<artifactId>analyticsImporter</artifactId>
<version>0.1</version>
<name>Analytics Importer</name>
<dependencies>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-analytics</artifactId>
<version>v3-rev41-1.14.2-beta</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-oauth2</artifactId>
<version>v2-rev36-1.14.2-beta</version>
</dependency>
<dependency>
<groupId>com.google.api.client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.3.1-alpha</version>
</dependency>
</dependencies>
</project>
我错过了什么?
答案 0 :(得分:2)
您似乎错过了Java 6 (and higher) Extensions to the Google OAuth Client Library for Java工件的依赖项:
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-java6</artifactId>
<version>1.14.1-beta</version>
</dependency>
答案 1 :(得分:1)
我认为你错过了实际包含FileCredentialStore类的OAuth2的maven依赖项。检查一下是否有效?
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-java6</artifactId>
<version>1.12.0-beta</version>
</dependency>
答案 2 :(得分:0)
答案 3 :(得分:0)
google-oauth-client-servlet包含FileCredentialStore类