如何修复不可解析的导入 POM:com.google.cloud:spring-cloud-gcp-dependencies

How to fix Non-resolvable import POM: com.google.cloud:spring-cloud-gcp-dependencies

正在尝试从 https://github.com/GoogleCloudPlatform/spring-cloud-gcp

构建 spring-cloud-gcp
  1. 许多失败 compile/install 尝试由于失败的测试(单元和 checkstyle) - 决定只是禁用 and/or 不失败由于测试 - 太好了,工作,整个构建(所有子项目)编译
  2. 想要将 spring-cloud-gcp-data-firestore-sample(pom 在下方)部署到 Cloud 运行,因此更改了 pom 中的父引用(如 suggested/documented 在 pom 中)。
  3. 现在不能 compile/install spring-cloud-gcp-data-firestore-sample 并得到这个错误“**不可解析的导入 POM:com.google.cloud:spring-cloud-gcp-dependencies:pom:2.3.12.RELEASE 在 https://repo.maven.apache.org/maven2**"
  4. 中找不到

我试过:

  1. 向 pom 添加额外的 spring maven 回购(见下面的 pom)- 运气不好,根据错误消息,maven 似乎甚至没有检查添加的回购
  2. referencing/using 不同版本的 spring-boot-starter-parent - 运气不好,错误中没有任何变化
  3. mvn -U clean compile - 运气不好

有人有什么想法吗?非常感谢任何建议。

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.12.RELEASE</version>
    <relativePath/>
   </parent>

  <modelVersion>4.0.0</modelVersion>
  <name>Spring Cloud GCP Code Sample - Spring Data Firestore</name>
  <artifactId>spring-cloud-gcp-data-firestore-sample</artifactId>

  <properties>
    <integration-test.tags.exclude>native</integration-test.tags.exclude>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>spring-cloud-gcp-dependencies</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>spring-cloud-gcp-starter-data-firestore</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>spring-cloud-gcp-autoconfigure</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-webflux</artifactId>
    </dependency>

    <dependency>
      <groupId>io.projectreactor</groupId>
      <artifactId>reactor-core</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <!-- JUnit5 is required for Test Containers. -->
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>gcloud</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>native</id>
      <activation>
          <property>
            <name>it.native</name>
          </property>
      </activation>
      <properties>
        <!-- Include only native tests, exclude all others -->
        <integration-test.tags.include>native</integration-test.tags.include>
        <integration-test.tags.exclude/>

        <!-- Native build args -->
        <native.build.args>
          --enable-url-protocols=http,https
          --no-fallback
          --no-server
        </native.build.args>

        <!-- Paketo buildpacks used for building native image -->
        <builder>paketobuildpacks/builder:tiny</builder>
      </properties>

      <dependencies>
        <dependency>
          <groupId>org.springframework.experimental</groupId>
          <artifactId>spring-native</artifactId>
          <version>${spring-native.version}</version>
        </dependency>
        <dependency>
          <groupId>com.google.cloud</groupId>
          <artifactId>google-cloud-graalvm-support</artifactId>
          <version>${google-cloud-graalvm-support.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-context-indexer</artifactId>
          <optional>true</optional>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <plugin>
            <groupId>org.springframework.experimental</groupId>
            <artifactId>spring-aot-maven-plugin</artifactId>
            <version>${spring-native.version}</version>
            <dependencies>
              <dependency>
                <groupId>com.google.cloud</groupId>
                <artifactId>spring-cloud-gcp-native-support</artifactId>
                <version>${project.version}</version>
              </dependency>
            </dependencies>
            <executions>
              <execution>
                <id>test-generate</id>
                <goals>
                  <goal>test-generate</goal>
                </goals>
              </execution>
              <execution>
                <id>generate</id>
                <goals>
                  <goal>generate</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
              <classifier>${classifier}</classifier>
              <image>
                <builder>${builder}</builder>
                <name>${project.artifactId}:test</name>
                <env>
                  <BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
                  <BP_NATIVE_IMAGE_BUILD_ARGUMENTS>${native.build.args}</BP_NATIVE_IMAGE_BUILD_ARGUMENTS>
                </env>
                <pullPolicy>IF_NOT_PRESENT</pullPolicy>
              </image>
            </configuration>
            <executions>
              <execution>
                <id>build-docker-image-before-integration-tests</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>build-image</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <repositories>
        <repository>
          <id>spring-releases</id>
          <name>Spring Releases</name>
          <url>https://repo.spring.io/release</url>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>spring-releases</id>
          <name>Spring Releases</name>
          <url>https://repo.spring.io/release</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

  </profiles>

您正在从 project.version 继承 com.google.cloud:spring-cloud-gcp-dependencies 的版本,在您的情况下为 2.3。12.RELEASE。

      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>spring-cloud-gcp-dependencies</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

实际上,您想要指定 maven repository 中列出的有效版本。