2
votes

I'm trying to run the YouTube JSON-C Sample in eclipse. I have followed the instructions in the link and I managed to run it in the command line using mvn -q exec:java, but when I import the project to eclipse (I use eclipse indigo), it says that "The import com.google.api.client.googleapis cannot be resolved", and gives me compiler errors in every line that is related to the api. Is there some other configuration that needs to be done? Specifically adding google-api-java-client-1.5.0-beta jars to the build path?

2
Have you installed Eclipse M2 plugin? Once you have it installed, then you just need to import the project as an existing Maven project in eclipse. - Jugal Shah
Yes I did. The maven plugin is definitely installed. And so is the mercurial plugin (if that matters). - Alex1987
Try to update the Maven dependencies and Project Configuration and make sure the correct JAR's are added to the build path. - Jugal Shah
Wait a minute.. I managed to compile and run the project from the terminal, so it must be related solely to the plugin's configurations, right? - Alex1987

2 Answers

1
votes

Ok I finally solved the problem. What did the work for me was to execute mvn eclipse:eclipse on the project folder in terminal...

0
votes

You need to check if you are pulling out all the dependencies in pom.xml from the repository:

<dependencies>
  <dependency>
    <groupId>com.google.api-client</groupId>
    <artifactId>google-api-client</artifactId>
    <version>1.5.0-beta</version>
  </dependency>
  <dependency>
    <groupId>com.google.http-client</groupId>
    <artifactId>google-http-client</artifactId>
    <version>1.5.0-beta</version>
  </dependency>
</dependencies>

Check the settings.xml file in the Maven installation directory if it is pointing to a global repository or if you have hosted your own Nexus/Sonatype repository then make sure that your settings.xml points to that and also you must have the above two jars in your repository.

Or if you just want to get the project up and running, then instead of importing as a Maven project, just import it as a normal Java project and manually add the two libraries to the project's classpath. That should at the least get you started with the project without worrying about the Maven stuff.