I have a java project with maven dependency management. Using the Googlemaps dependency, I am unable to find setUserCredentials.
MapsService myService = new MapsService(
myService.setUserCredentials("root@gmail.com", "paword");
This is my maven dependency in the pom file.
<dependency>
<groupId>com.google.gdata</groupId>
<artifactId>gdata-maps</artifactId>
<version>2.0</version>
</dependency>
And here is the Java code:
package com.google.gdata.client.sample.maps;
import com.google.gdata.client.*;
import com.google.gda开发者_JAVA技巧ta.client.maps.*;
import com.google.gdata.data.*;
import com.google.gdata.data.maps.*;
import com.google.gdata.util.*;
import java.io.IOException;
import java.net.URL;
public class GetMapsFeed {
public static void main(String[] args) {
// Name your service
MapsService myService = new MapsService("applicationName");
try {
// Replace these credentials with your own
myService.setUserCredentials("username","password");
} catch(AuthenticationException e) {
}
try {
printUserMaps(myService);
} catch(ServiceException e) {
} catch(IOException e) {
}
}
Picture
I fight a lot but found the problems. I need add dependency of the core 1.0 and google java-1.40.3 map.2.0.jar. Thanks for all .
1) Change the version to 1.0 or any other previous version to ensure there is nothing wrong with dependency you've downloaded.
2) Check your local package, package com.google.gdata.client.sample.maps;
again to ensure you don't have any other version of MapsService
3) Also type Ctrl+T in Eclipse, and see which jar holds this file in your system?
Hope this helps.
精彩评论