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

Time:03-25

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>

CodePudding user response:

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.

  • Related