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

发布于 2025-01-16 18:58:36 字数 8918 浏览 0 评论 0原文

尝试从 https://github.com/GoogleCloudPlatform/spring-cloud 构建 spring-cloud-gcp -gcp

  1. 由于测试失败(单元和检查样式),许多失败的编译/安装尝试 - 决定仅禁用和/或不因测试而失败 - 很好,有效,整个构建(所有子项目)已编译
  2. 想要部署spring-cloud-gcp-data-firestore-sample(pom 如下)到 Cloud run,因此更改了 pom 中的父引用(如 pom 中建议/记录)。
  3. 现在无法编译/安装 spring-cloud-gcp-data-firestore-sample 并收到此错误“**Non-resolvable import POM: com.google.cloud:spring-cloud-gcp-dependency:pom:2.3.12在 https://repo.maven.apache.org/maven2**"

我尝试过:

  1. 向 pom 添加额外的 spring maven 存储库(请参阅下面的 pom) - 没有运气,并且基于错误消息 maven 似乎甚至没有检查添加的存储库的
  2. 引用/使用不同版本的 spring-boot-starter-parent - 没有运气,错误
  3. mvn -U clean 编译没有任何变化 - 没有运气

有人有任何想法吗?任何建议都非常感激。

<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>

Trying to build spring-cloud-gcp from https://github.com/GoogleCloudPlatform/spring-cloud-gcp

  1. Many failed compile/install attempts due to failed tests (unit and checkstyle) - decided to just disable and/or not fail due to tests - great, that worked, entire build (all sub projects) compiled
  2. Wanted to deploy the spring-cloud-gcp-data-firestore-sample (pom is below) to Cloud run, so changed the parent reference in the pom (as suggested/documented in the pom).
  3. Now can't compile/install spring-cloud-gcp-data-firestore-sample and get this error "**Non-resolvable import POM: com.google.cloud:spring-cloud-gcp-dependencies:pom:2.3.12.RELEASE was not found in https://repo.maven.apache.org/maven2**"

I've tried:

  1. Adding additional spring maven repos to the pom (see pom below) - no luck, and based on the error message maven doesn't even seem to be checking the added repo's
  2. referencing/using different versions of the spring-boot-starter-parent - no luck, nothing changed in the error
  3. mvn -U clean compile - no luck

Anyone got any ideas? Any suggestions greatly appreciated.

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凌乱心跳 2025-01-23 18:58:36

您将从 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 存储库

You are inheriting version for com.google.cloud:spring-cloud-gcp-dependencies from project.version, which is 2.3.12.RELEASE in your case.

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

When in fact, you want to specify a valid version as listed in maven repository.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文