Search code examples
mavengoogle-cloud-platformartifact

Build with dependency in gcp artifact registry


Building an application with a dependency to google cloud platform artifact registry results in an error:

Cannot access artifactregistry://us-central1-maven.pkg.dev/project/repository with type default using the available connector factories: BasicRepositoryConnectorFactory: Cannot access artifactregistry://us-central1-maven.pkg.dev/project/repository using the registered transporter factories: WagonTransporterFactory: java.util.NoSuchElementException

Solution

  • You need to add com.google.cloud.artifactregistry maven extension to your pom.xml (not covered in the documentation), it is not enough with repositories, distributionmanagement and dependency.

    <build>
        <extensions>
            <extension>
                <groupId>com.google.cloud.artifactregistry</groupId>
                <artifactId>artifactregistry-maven-wagon</artifactId>
                <version>2.1.0</version>
            </extension>
        </extensions>
    </build>