Google存储客户端库(appengine-gcs-client)具有不可用的依赖关系(google-http-client-parent:pom:1.24.1)

Dav*_*vid 8 java google-app-engine maven google-cloud-storage

我将appengine-gcs-client添加到我的Google AppEngine Standard项目中:

    *<dependency>
        <groupId>com.google.appengine.tools</groupId>
        <artifactId>appengine-gcs-client</artifactId>
        <version>0.7</version>
    </dependency>*
Run Code Online (Sandbox Code Playgroud)

(按照此页面上的说明操作:https://cloud.google.com/appengine/docs/standard/java/googlecloudstorageclient/setting-up-cloud-storage)

编译项目会引发以下错误(几天前没有问题):

[错误]无法在项目myproject2上执行目标:无法解析项目com.myproject2的依赖项:myproject2:war:1.0-SNAPSHOT:无法在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:无法读取com.google.http-client的工件描述符:google-http-client-appengine:jar:1.24.1:失败找到com.google.http-client:google-http-client-parent:pom:https ://repo.maven.apache.org/maven2中的1.24.1 缓存在本地存储库中,解决方案将不会重新尝试,直到中心的更新间隔已经过去或强制更新 - > [帮助1]

谷歌似乎刚刚在依赖树中创建了一些错误.

有什么方法可以解决它,即使只是暂时的解决方法吗?


使用重现错误的完整pom更新我的问题:

<?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>
Run Code Online (Sandbox Code Playgroud)

Mus*_*lan 4

似乎 Google 已经做了一些重命名(他们删除了 artifactIds 的“-appengine”部分),这在 1.24.1 版本中不起作用。尝试用以下内容替换 gcs 依赖项:

<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>
Run Code Online (Sandbox Code Playgroud)

它将排除 1.24.1 版本的所有非工作依赖项,并使用之前的 1.23.0。您可能最终需要强制 Maven 使用“-U”标志更新远程依赖项,例如,

mvn -U package
Run Code Online (Sandbox Code Playgroud)