{"id":9386,"date":"2025-04-17T15:13:22","date_gmt":"2025-04-17T09:43:22","guid":{"rendered":"https:\/\/kognivera.com\/?p=9386"},"modified":"2025-04-17T16:31:31","modified_gmt":"2025-04-17T11:01:31","slug":"building-reusable-libraries-with-google-cloud-artifact-registry","status":"publish","type":"post","link":"https:\/\/kognivera.com\/staging\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/","title":{"rendered":"Building Reusable Libraries with Google Cloud Artifact Registry"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"9386\" class=\"elementor elementor-9386\" data-elementor-post-type=\"post\">\n\t\t\t\t<div class=\"elementor-element elementor-element-91042c9 e-flex e-con-boxed e-con e-parent\" data-id=\"91042c9\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-ac848fb elementor-widget elementor-widget-text-editor\" data-id=\"ac848fb\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span style=\"color: #333300;\">When you\u2019re building multiple independently deployable microservices, you may encounter many common functional or non-functional use cases. In such cases, it makes sense to build a reusable library, package it as an artifact, and import it into all your microservice projects. Some common examples include customizing logging and tracing functionality or integrating with a third-party authorization provider.<\/span><\/p><p><span style=\"color: #333300;\">One of the most important tasks when building a reusable library is packaging and deploying it to an artifact server. Google Cloud Platform offers a solution for this by providing a dedicated service called Artifact Registry, where you can deploy these artifacts. Artifact Registry is a fully managed service that allows you to securely store and manage artifacts such as JAR files and Docker images. Once deployed, these artifacts can be easily imported and used through build automation tools like Maven or Gradle.<\/span><\/p><p><span style=\"color: #333300;\">This guide provides step-by-step instructions to deploy any Gradle-based Java project to Google Cloud Artifact Registry.<\/span><\/p><div><h2 class=\"\" data-start=\"947\" data-end=\"965\"><span style=\"color: #333300;\">Prerequisites<\/span><\/h2><p class=\"\" data-start=\"967\" data-end=\"1018\"><span style=\"color: #333300;\">Before you begin, make sure you have the following:<\/span><\/p><ul><li><span style=\"font-style: inherit; font-weight: inherit; color: #333300;\">A <\/span><strong style=\"font-style: inherit; color: #333300;\" data-start=\"1025\" data-end=\"1049\">Google Cloud account<\/strong><span style=\"font-style: inherit; font-weight: inherit; color: #333300;\"> with an active project.<\/span><\/li><li><strong style=\"font-style: inherit; color: #333300;\" data-start=\"1077\" data-end=\"1097\">Google Cloud SDK<\/strong><span style=\"font-style: inherit; font-weight: inherit; color: #333300;\"> installed on your machine.<\/span><\/li><li><span style=\"font-style: inherit; font-weight: inherit; color: #333300;\">An <\/span><strong style=\"font-style: inherit; color: #333300;\" data-start=\"1131\" data-end=\"1163\">Artifact Registry repository<\/strong><span style=\"font-style: inherit; font-weight: inherit; color: #333300;\"> created in your GCP project.<\/span><\/li><li><span style=\"font-style: inherit; font-weight: inherit; color: #333300;\">A <\/span><strong style=\"font-style: inherit; color: #333300;\" data-start=\"1198\" data-end=\"1221\">Service Account Key<\/strong><span style=\"font-style: inherit; font-weight: inherit; color: #333300;\"> in JSON format with permission to push to Artifact Registry.<\/span><\/li><\/ul><h3 data-start=\"1289\" data-end=\"1333\"><span style=\"color: #333300;\">Step 1: Authenticate with Google Cloud<\/span><\/h3><div><h6 style=\"padding-left: 40px;\"><span lang=\"EN-US\" style=\"color: #333300;\">1. Authenticate using your service account key:<\/span><\/h6><\/div><\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-30364de e-flex e-con-boxed e-con e-parent\" data-id=\"30364de\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-ee9f391 elementor-widget elementor-widget-code-highlight\" data-id=\"ee9f391\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>gcloud auth activate-service-account --key-file \/path\/to\/your\/service-account-key.json\n \t\nIf you don\u2019t already have a service account key file, follow this guide to create one. \u2013 \n\nhttps:\/\/cloud.google.com\/iam\/docs\/keys-create-delete<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-92a3e89 e-flex e-con-boxed e-con e-parent\" data-id=\"92a3e89\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-cfa9d76 elementor-widget elementor-widget-text-editor\" data-id=\"cfa9d76\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h6 style=\"padding-left: 40px;\"><span style=\"color: #333300;\">2. Set the active project:<\/span><\/h6>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-e41138a e-flex e-con-boxed e-con e-parent\" data-id=\"e41138a\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-2f5937a elementor-widget elementor-widget-code-highlight\" data-id=\"2f5937a\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>gcloud config set project YOUR_PROJECT_ID\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-ec69627 e-flex e-con-boxed e-con e-parent\" data-id=\"ec69627\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-8e7df33 elementor-widget elementor-widget-text-editor\" data-id=\"8e7df33\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h6 style=\"padding-left: 40px;\" data-start=\"1690\" data-end=\"1723\"><span style=\"color: #333300;\">3.Enable Artifact Registry API:<\/span><\/h6>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7bc0fb8 elementor-widget elementor-widget-code-highlight\" data-id=\"7bc0fb8\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>gcloud services enable artifactregistry.googleapis.com\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-355f3dc elementor-widget elementor-widget-text-editor\" data-id=\"355f3dc\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h4 data-start=\"1807\" data-end=\"1857\">Step 2: Update <code data-start=\"1828\" data-end=\"1842\">build.gradle<\/code> for Publishing<\/h4><h5 data-start=\"1859\" data-end=\"1886\">\u00a0Add Required Plugins<\/h5>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b3198a3 elementor-widget elementor-widget-code-highlight\" data-id=\"b3198a3\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-java line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-java\">\n\t\t\t\t\t<xmp>plugins {\r\n    id 'java'\r\n    id 'maven-publish'\r\n    id 'com.google.cloud.artifactregistry.gradle-plugin' version '2.2.1'\r\n}\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-004120c elementor-widget elementor-widget-text-editor\" data-id=\"004120c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h4 data-start=\"2025\" data-end=\"2058\"><span style=\"color: #333300;\">Configure Publishing Block<\/span><\/h4><p><span style=\"color: #333300;\">Configure Artifact Publishing to Artifact Registry Add the publishing block to configure Artifact Registry as your destination for the published artifact:<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d7da504 elementor-widget elementor-widget-code-highlight\" data-id=\"d7da504\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-java line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-java\">\n\t\t\t\t\t<xmp>publishing {\r\n publications {\r\n     mavenJava(MavenPublication) {\r\n         groupId = group  \/\/ Your group ID\r\n         artifactId = 'my-artifact'  \/\/ Your desired artifact name\r\n         version = buildTimeStamp  \/\/ Use the dynamically generated version\r\n\r\n         from components.java  \/\/ Publish the Java component (e.g., JAR file)\r\n     }\r\n }\r\n\r\n repositories {\r\n     maven {\r\n         url = uri(\"https:\/\/${YOUR_PROJECT_ID}-maven.pkg.dev\/${YOUR_LOCATION}\/${YOUR_REPO_NAME}\")\r\n         credentials {\r\n             username = \"_json_key\"\r\n             password = file(\"\/path\/to\/your\/service-account-key.json\").text  \/\/ Path to your service account key file\r\n         }\r\n         authentication {\r\n             basic(BasicAuthentication)\r\n         }\r\n     }\r\n }\r\n}\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f771d2e elementor-widget elementor-widget-text-editor\" data-id=\"f771d2e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3><span style=\"color: #333300;\">Key Points:<\/span><\/h3><ul><li><span style=\"color: #333300;\">Replace YOUR_PROJECT_ID, YOUR_LOCATION, and YOUR_REPO_NAME with your actual Google Cloud project, location, and Artifact Registry repository.<\/span><\/li><li><span style=\"color: #333300;\">service-account-key.json should be the path to your service account JSON key file, which will authenticate your request to publish the artifact.<\/span><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-7b5e262 e-flex e-con-boxed e-con e-parent\" data-id=\"7b5e262\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-8372d88 elementor-widget elementor-widget-text-editor\" data-id=\"8372d88\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h4><span style=\"color: #333300;\">Step 3: Create an Artifact Registry Repository<\/span><\/h4><p class=\"\" data-start=\"3041\" data-end=\"3079\"><span style=\"color: #333300;\">To create a repository from Google Cloud console:<\/span><\/p><p><span style=\"color: #333300;\"><a style=\"color: #333300;\" href=\"https:\/\/console.cloud.google.com\/artifacts.\">https:\/\/console.cloud.google.com\/artifacts.<\/a><\/span><\/p><p class=\"FirstParagraph\"><span lang=\"EN-US\" style=\"color: #333300;\">You can also achieve this by using the gcloud CLI.<\/span><\/p><p><span style=\"color: #333300;\">YOUR_LOCATION can be one of the available regions served by Google Cloud Platform. This should ideally be the region physically closest to your build or publishing server. Here, we select us-central-1.<\/span><\/p><p><span style=\"color: #333300;\">With this configuration, the repository path to be configured in build.gradle would be :<\/span><\/p><p><span style=\"color: #333300;\"><a style=\"color: #333300;\" href=\"https:\/\/us-central1-maven.pkg.dev\/apps-project\/logging-library\">https:\/\/us-central1-maven.pkg.dev\/apps-project\/logging-library<\/a><\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-d44a05b e-flex e-con-boxed e-con e-parent\" data-id=\"d44a05b\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-677723f elementor-widget elementor-widget-text-editor\" data-id=\"677723f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3 data-start=\"3462\" data-end=\"3506\"><span style=\"color: #333300;\">Step 4: Build and Publish the Artifact<strong style=\"font-size: 1rem; font-style: inherit;\" data-start=\"3511\" data-end=\"3534\">\u00a0<\/strong><\/span><\/h3><p><span style=\"color: #333300;\">Once you\u2019ve configured your build.gradle file, follow these steps to build and publish your artifact to Google Cloud Artifact Registry:<\/span><\/p><p><span style=\"color: #333300;\">Build the project: gradle build This will compile your project and create a .jar (or other appropriate artifact).<\/span><\/p><p><span style=\"color: #333300;\">Publish the artifact to Artifact Registry: gradle publish<\/span><\/p><p><span style=\"color: #333300;\">This will:<\/span><\/p><ul><li><span style=\"color: #333300;\">Create the artifact (e.g., JAR file).<\/span><\/li><li><span style=\"color: #333300;\">Upload the artifact to your Artifact Registry repository in Google Cloud.<\/span><\/li><\/ul><p><span style=\"color: #333300;\">When you publish your artifact, you may run into 403 permissions error. Please make sure your service account has permissions to read and write to your artifact repository.<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8c8e245 elementor-widget elementor-widget-text-editor\" data-id=\"8c8e245\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3 data-start=\"3761\" data-end=\"3794\"><span style=\"color: #333300;\">Step 5: Verify the Artifact<\/span><\/h3><p><span style=\"color: #333300;\">After publishing your artifact, verify that it has been successfully uploaded:<\/span><\/p><ul><li><span style=\"color: #333300;\">Open the Google Cloud Console.<\/span><\/li><li><span style=\"color: #333300;\">Navigate to Artifact Registry under the Storage section.<\/span><\/li><li><span style=\"color: #333300;\">Select your repository.<\/span><\/li><li><span style=\"color: #333300;\">You should see the uploaded artifact listed with the version you specified (or timestamp if configured that way). You can now use this artifact in other projects or CI\/CD pipelines.<\/span><\/li><\/ul><h3 data-start=\"4021\" data-end=\"4076\"><span style=\"color: #333300;\">Step 6: Use the Library in Another Gradle Project<\/span><\/h3><p><span style=\"color: #333300;\">In your gradle-based Java project, configure the artifact repository in the list of repositories in build.gradle:<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e3da046 elementor-widget elementor-widget-code-highlight\" data-id=\"e3da046\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-java line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-java\">\n\t\t\t\t\t<xmp>repositories {\r\n    mavenCentral()\r\n    maven {\r\n        url \"artifactregistry:\/\/us-central1-maven.pkg.dev\/apps-project\/logging-library\"\r\n        credentials {\r\n            username = \"_json_key_base64\"\r\n            password = \"${System.getenv(\"ARTIFACT_REGISTRY_SECRET\")}\"\r\n        }\r\n        authentication {\r\n            basic(BasicAuthentication)\r\n        }\r\n    }\r\n}\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b0efba6 elementor-widget elementor-widget-text-editor\" data-id=\"b0efba6\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h6 data-start=\"4502\" data-end=\"4541\"><span style=\"color: #333300;\">Fetch <code data-start=\"4515\" data-end=\"4541\">ARTIFACT_REGISTRY_SECRET<\/code><\/span><span lang=\"EN-US\" style=\"color: #333300;\">, run the following command:<\/span><\/h6>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e850c40 elementor-widget elementor-widget-code-highlight\" data-id=\"e850c40\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>gcloud artifacts print-settings gradle \\\r\n    --project=apps-project \\\r\n    --repository=logging-library \\\r\n    --location=us-central1\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7370e52 elementor-widget elementor-widget-text-editor\" data-id=\"7370e52\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span lang=\"EN-US\" style=\"color: #333300;\">In this article, we saw how to publish and reuse libraries via Google Cloud Artifact Registry. First, how to enable the Artifact Registry API and create a repository. Develop the library, define dependencies, and package it. Authenticate with a service account, then deploy using gradle publish. Finally, how to import the library in other projects by configuring the registry URL in build files.<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>When you\u2019re building multiple independently deployable microservices, you may encounter many common functional or non-functional use cases. In such cases, it makes sense to build a reusable library, package it as an artifact, and import it into all your microservice projects. Some common examples include customizing logging and tracing functionality or integrating with a third-party [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-9386","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Building Reusable Libraries with Google Cloud Artifact Registry - KogniVera<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Building Reusable Libraries with Google Cloud Artifact Registry - KogniVera\" \/>\n<meta property=\"og:description\" content=\"When you\u2019re building multiple independently deployable microservices, you may encounter many common functional or non-functional use cases. In such cases, it makes sense to build a reusable library, package it as an artifact, and import it into all your microservice projects. Some common examples include customizing logging and tracing functionality or integrating with a third-party [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/\" \/>\n<meta property=\"og:site_name\" content=\"KogniVera\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/profile.php?id=61555489512431\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-17T09:43:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-17T11:01:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kognivera.com\/staging\/wp-content\/uploads\/2024\/11\/updatedLogo2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"496\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Gopikrishna Vemula\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@KogniVera\" \/>\n<meta name=\"twitter:site\" content=\"@KogniVera\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Anand Gunda\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/\"},\"author\":{\"name\":\"Gopikrishna Vemula\",\"@id\":\"https:\/\/kognivera.com\/#\/schema\/person\/368fe83c2b58654da8593c18c19fb1ca\"},\"headline\":\"Building Reusable Libraries with Google Cloud Artifact Registry\",\"datePublished\":\"2025-04-17T09:43:22+00:00\",\"dateModified\":\"2025-04-17T11:01:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/\"},\"wordCount\":647,\"publisher\":{\"@id\":\"https:\/\/kognivera.com\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/\",\"url\":\"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/\",\"name\":\"Building Reusable Libraries with Google Cloud Artifact Registry - KogniVera\",\"isPartOf\":{\"@id\":\"https:\/\/kognivera.com\/#website\"},\"datePublished\":\"2025-04-17T09:43:22+00:00\",\"dateModified\":\"2025-04-17T11:01:31+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kognivera.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Building Reusable Libraries with Google Cloud Artifact Registry\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kognivera.com\/#website\",\"url\":\"https:\/\/kognivera.com\/\",\"name\":\"KogniVera\",\"description\":\"Your IT Partner\",\"publisher\":{\"@id\":\"https:\/\/kognivera.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kognivera.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/kognivera.com\/#organization\",\"name\":\"KogniVera\",\"url\":\"https:\/\/kognivera.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kognivera.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/kognivera.com\/staging\/wp-content\/uploads\/2024\/11\/updatedLogo1-1.png\",\"contentUrl\":\"https:\/\/kognivera.com\/staging\/wp-content\/uploads\/2024\/11\/updatedLogo1-1.png\",\"width\":500,\"height\":134,\"caption\":\"KogniVera\"},\"image\":{\"@id\":\"https:\/\/kognivera.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/profile.php?id=61555489512431\",\"https:\/\/x.com\/KogniVera\",\"https:\/\/www.linkedin.com\/company\/kognivera\/\",\"https:\/\/www.instagram.com\/kognivera\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/kognivera.com\/#\/schema\/person\/368fe83c2b58654da8593c18c19fb1ca\",\"name\":\"Gopikrishna Vemula\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kognivera.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7ddf822111efa7383b1bec6cdd1f786b3685f67f3658d664d7a21033d10879e9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7ddf822111efa7383b1bec6cdd1f786b3685f67f3658d664d7a21033d10879e9?s=96&d=mm&r=g\",\"caption\":\"Gopikrishna Vemula\"},\"url\":\"http:\/\/Technical%20Architect\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Building Reusable Libraries with Google Cloud Artifact Registry - KogniVera","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/","og_locale":"en_US","og_type":"article","og_title":"Building Reusable Libraries with Google Cloud Artifact Registry - KogniVera","og_description":"When you\u2019re building multiple independently deployable microservices, you may encounter many common functional or non-functional use cases. In such cases, it makes sense to build a reusable library, package it as an artifact, and import it into all your microservice projects. Some common examples include customizing logging and tracing functionality or integrating with a third-party [&hellip;]","og_url":"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/","og_site_name":"KogniVera","article_publisher":"https:\/\/www.facebook.com\/profile.php?id=61555489512431","article_published_time":"2025-04-17T09:43:22+00:00","article_modified_time":"2025-04-17T11:01:31+00:00","og_image":[{"width":1200,"height":496,"url":"https:\/\/kognivera.com\/staging\/wp-content\/uploads\/2024\/11\/updatedLogo2.jpg","type":"image\/jpeg"}],"author":"Gopikrishna Vemula","twitter_card":"summary_large_image","twitter_creator":"@KogniVera","twitter_site":"@KogniVera","twitter_misc":{"Written by":"Anand Gunda","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/#article","isPartOf":{"@id":"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/"},"author":{"name":"Gopikrishna Vemula","@id":"https:\/\/kognivera.com\/#\/schema\/person\/368fe83c2b58654da8593c18c19fb1ca"},"headline":"Building Reusable Libraries with Google Cloud Artifact Registry","datePublished":"2025-04-17T09:43:22+00:00","dateModified":"2025-04-17T11:01:31+00:00","mainEntityOfPage":{"@id":"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/"},"wordCount":647,"publisher":{"@id":"https:\/\/kognivera.com\/#organization"},"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/","url":"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/","name":"Building Reusable Libraries with Google Cloud Artifact Registry - KogniVera","isPartOf":{"@id":"https:\/\/kognivera.com\/#website"},"datePublished":"2025-04-17T09:43:22+00:00","dateModified":"2025-04-17T11:01:31+00:00","breadcrumb":{"@id":"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/kognivera.com\/blog\/building-reusable-libraries-with-google-cloud-artifact-registry\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kognivera.com\/"},{"@type":"ListItem","position":2,"name":"Building Reusable Libraries with Google Cloud Artifact Registry"}]},{"@type":"WebSite","@id":"https:\/\/kognivera.com\/#website","url":"https:\/\/kognivera.com\/","name":"KogniVera","description":"Your IT Partner","publisher":{"@id":"https:\/\/kognivera.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kognivera.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/kognivera.com\/#organization","name":"KogniVera","url":"https:\/\/kognivera.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kognivera.com\/#\/schema\/logo\/image\/","url":"https:\/\/kognivera.com\/staging\/wp-content\/uploads\/2024\/11\/updatedLogo1-1.png","contentUrl":"https:\/\/kognivera.com\/staging\/wp-content\/uploads\/2024\/11\/updatedLogo1-1.png","width":500,"height":134,"caption":"KogniVera"},"image":{"@id":"https:\/\/kognivera.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/profile.php?id=61555489512431","https:\/\/x.com\/KogniVera","https:\/\/www.linkedin.com\/company\/kognivera\/","https:\/\/www.instagram.com\/kognivera\/"]},{"@type":"Person","@id":"https:\/\/kognivera.com\/#\/schema\/person\/368fe83c2b58654da8593c18c19fb1ca","name":"Gopikrishna Vemula","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kognivera.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7ddf822111efa7383b1bec6cdd1f786b3685f67f3658d664d7a21033d10879e9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7ddf822111efa7383b1bec6cdd1f786b3685f67f3658d664d7a21033d10879e9?s=96&d=mm&r=g","caption":"Gopikrishna Vemula"},"url":"http:\/\/Technical%20Architect"}]}},"_links":{"self":[{"href":"https:\/\/kognivera.com\/staging\/wp-json\/wp\/v2\/posts\/9386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kognivera.com\/staging\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kognivera.com\/staging\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kognivera.com\/staging\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kognivera.com\/staging\/wp-json\/wp\/v2\/comments?post=9386"}],"version-history":[{"count":119,"href":"https:\/\/kognivera.com\/staging\/wp-json\/wp\/v2\/posts\/9386\/revisions"}],"predecessor-version":[{"id":9518,"href":"https:\/\/kognivera.com\/staging\/wp-json\/wp\/v2\/posts\/9386\/revisions\/9518"}],"wp:attachment":[{"href":"https:\/\/kognivera.com\/staging\/wp-json\/wp\/v2\/media?parent=9386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kognivera.com\/staging\/wp-json\/wp\/v2\/categories?post=9386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kognivera.com\/staging\/wp-json\/wp\/v2\/tags?post=9386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}