Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Storage client library (appengine-gcs-client) has unavailable dependency (google-http-client-parent:pom:1.24.1)

I add appengine-gcs-client to my Google AppEngine Standard project with this:

    *<dependency>
        <groupId>com.google.appengine.tools</groupId>
        <artifactId>appengine-gcs-client</artifactId>
        <version>0.7</version>
    </dependency>*

(following instructions on this page: https://cloud.google.com/appengine/docs/standard/java/googlecloudstorageclient/setting-up-cloud-storage)

Compiling the project throws the following error (there was no problem few days ago):

[ERROR] Failed to execute goal on project myproject2: Could not resolve dependencies for project com.myproject2:myproject2:war:1.0-SNAPSHOT: Failed to collect dependencies at com.google.appengine.tools:appengine-gcs-client:jar:0.7 -> com.google.api-client:google-api-client-appengine:jar:1.24.1 -> com.google.oauth-client:google-oauth-client-appengine:jar:1.24.1 -> com.google.http-client:google-http-client-appengine:jar:1.24.1: Failed to read artifact descriptor for com.google.http-client:google-http-client-appengine:jar:1.24.1: Failure to find com.google.http-client:google-http-client-parent:pom:1.24.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

It seems Google has just created some error in the dependent tree.

Is there any way I can fix it, even just a temporarily workaround?


Updating my question with the full pom that reproduces the error:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
    <packaging>war</packaging>
    <version>0.1.0-SNAPSHOT</version>

    <groupId>com.myproject2</groupId>
    <artifactId>myproject2</artifactId>

    <properties>
        <appengine.maven.plugin.version>1.3.1</appengine.maven.plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
    </properties>

    <prerequisites>
        <maven>3.3.9</maven>
    </prerequisites>

    <dependencies>
        <!-- Compile/runtime dependencies -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>javax.servlet.jsp-api</artifactId>
            <version>2.3.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-1.0-sdk</artifactId>
            <version>1.9.59</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- For cloud storage https://cloud.google.com/appengine/docs/standard/java/googlecloudstorageclient/setting-up-cloud-storage -->
        <dependency>
            <groupId>com.google.appengine.tools</groupId>
            <artifactId>appengine-gcs-client</artifactId>
            <version>0.7</version>
        </dependency>

        <!-- Test Dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.endpoints</groupId>
            <artifactId>endpoints-framework</artifactId>
            <version>2.1.1</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.objectify</groupId>
            <artifactId>objectify</artifactId>
            <version>6.0</version>
        </dependency>
    </dependencies>

    <build>
        <!-- for hot reload of the web application -->
        <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>display-dependency-updates</goal>
                            <goal>display-plugin-updates</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>appengine-maven-plugin</artifactId>
                <version>${appengine.maven.plugin.version}</version>
            </plugin>
        </plugins>
    </build>
</project>
like image 847
David Avatar asked Aug 01 '18 13:08

David


2 Answers

Seems like Google has done some renaming (they dropped the "-appengine" part of the artifactIds) that doesn't work in the 1.24.1 versions. Try replacing your gcs dependency with the following:

<dependency>
    <groupId>com.google.appengine.tools</groupId>
    <artifactId>appengine-gcs-client</artifactId>
    <version>0.7</version>
  <exclusions>
    <exclusion>
      <groupId>com.google.http-client</groupId>
      <artifactId>*</artifactId>
    </exclusion> 
  </exclusions>
</dependency>
<dependency>
  <groupId>com.google.http-client</groupId>
  <artifactId>google-http-client-appengine</artifactId>
  <version>1.23.0</version>
</dependency>

It will exclude all the non-working dependencies with the 1.24.1 version and instead use the previous 1.23.0. You may finally need to force maven to update remote dependencies with the "-U" flag e.g.,

mvn -U package
like image 129
Musslan Avatar answered Oct 24 '22 09:10

Musslan


I was facing the error with appengine-mapreduce dependency. Got it fixed by excluding the dependencies that were throwing the error.

Original Map reduce dependency

<dependency>
            <groupId>com.google.appengine.tools</groupId>
            <artifactId>appengine-mapreduce</artifactId>
            <version>0.9</version>
</dependency>

Error that was showing up

Could not resolve dependencies for project PerpuleSmartShoppee:PerpuleSmartShoppee:war:0.0.1-SNAPSHOT: Failed to collect dependencies at com.google.appengine.tools:appengine-mapreduce:jar:0.9 -> com.google.appengine.tools:appengine-gcs-client:jar:0.4.3 -> com.google.api-client:google-api-client-appengine:jar:1.24.1 -> com.google.oauth-client:google-oauth-client-appengine:jar:1.24.1 -> com.google.http-client:google-http-client-appengine:jar:1.24.1: Failed to read artifact descriptor for com.google.http-client:google-http-client-appengine:jar:1.24.1: Failure to find com.google.http-client:google-http-client-parent:pom:1.24.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced ->

Got it changed to the following which got the build working

<dependency>
            <groupId>com.google.api-client</groupId>
            <artifactId>google-api-client</artifactId>
            <version>1.22.0</version>
            <exclusions>
                <exclusion>
                    <artifactId>guava-jdk5</artifactId>
                    <groupId>com.google.guava</groupId>
                </exclusion>
            </exclusions>
        </dependency>
    <dependency>
                <groupId>com.google.api-client</groupId>
                <artifactId>google-api-client-appengine</artifactId>
                <version>1.22.0</version>
                <exclusions>
                    <exclusion>
                        <artifactId>guava</artifactId>
                        <groupId>com.google.guava</groupId>
                    </exclusion>
                </exclusions>   
            </dependency>
            <dependency>
                <groupId>com.google.appengine.tools</groupId>
                <artifactId>appengine-gcs-client</artifactId>
                <version>0.3</version>
                <exclusions>
                    <exclusion>
                        <artifactId>guava</artifactId>
                        <groupId>com.google.guava</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
              <dependency>
                <groupId>com.google.appengine.tools</groupId>
                <artifactId>appengine-mapreduce</artifactId>
                <version>0.9</version>
                <exclusions>
                    <exclusion>
                        <artifactId>guava</artifactId>
                        <groupId>com.google.guava</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>appengine-gcs-client</artifactId>
                        <groupId>com.google.appengine.tools</groupId>
                    </exclusion>
                    <exclusion>
                        <groupId>com.google.api-client</groupId>
                        <artifactId>google-api-client</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>com.google.api-client</groupId>
                        <artifactId>google-api-client-appengine</artifactId>
                    </exclusion>

                </exclusions>
            </dependency> 
like image 36
Anmol Vijaywargiya Avatar answered Oct 24 '22 11:10

Anmol Vijaywargiya