Search code examples
javaeclipsemavengoogle-vision

Maven error when trying to add google vision tutorial libraries in Eclipse


I am trying to follow along this tutorial. I am using Eclipse and Maven 3.3.3.

So I start by adding the necessary dependencies in the pom file. These dependencies work without any issues:

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>com.google.truth</groupId>
    <artifactId>truth</artifactId>
    <version>0.28</version>
    <scope>test</scope>
</dependency>
<dependency>
    <!-- for checking HTTP response codes -->
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>test</scope>
</dependency>

However when I add these dependencies:

<dependency>
    <groupId>com.google.apis</groupId>
    <artifactId>google-api-services-vision</artifactId>
    <version>v1-rev19-1.22.0</version>
</dependency>
<dependency>
    <groupId>com.google.api-client</groupId>
    <artifactId>google-api-client</artifactId>
    <version>1.22.0</version>
</dependency>
<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>19.0</version>
</dependency>

I get an error

Failed to read artifact descriptor for com.google.code.findbugs:jsr305:jar:1.3.9 (Click for 15 more)

When I click it nothing actually happens so I cannot see anything else.

What I have tried so far:

I tried installing previous versions of these dependencies, however it didn't work.

I downloaded the actual jars of above dependencies and installed them using:

mvn install:install-file -DgroupId=com.google.apis -DartifactId=google-api-services-vision -Dpackaging=jar -Dversion=v1-rev19-1.22.0 -Dfile=C:\google-api-services-vision-v1-rev20-1.21.0.jar -DgeneratePom=true
mvn install:install-file -DgroupId=com.google.api-client -DartifactId=google-api-client -Dpackaging=jar -Dversion=1.22.0 -Dfile=C:\google-api-client-1.22.0.jar -DgeneratePom=true
mvn install:install-file -DgroupId=com.google.guava -DartifactId=guava -Dpackaging=jar -Dversion=19.0 -Dfile=C:\guava-19.0.jar -DgeneratePom=true

They seemed to work, and successfully recognized by Maven. However when I start to code I realized that some of their dependencies are not installed so I got all sorts of dependency errors and some of the classes were not recognized.

I deleted all related google repositories from the local Maven repository, then I edited the pom file again but I got this error:

Failed to read artifact descriptor for com.google.http-client:google-http-client(Click for 14 more)

And when I click on that, nothing happens.

I am all out of ideas at the moment. Any help would be appreciated.

Thanks.


Solution

  • A colleague suggested that I should do a clean install of all repositories also described in this question by going to the project directory in command line and type:

    mvn -U clean install
    

    Then it deleted all repositories and re-installed them in proper order. Now it works as intended.