{"id":5171,"date":"2018-08-19T20:09:20","date_gmt":"2018-08-19T20:09:20","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=5171"},"modified":"2021-02-27T09:07:01","modified_gmt":"2021-02-27T09:07:01","slug":"how-to-compile-and-build-gerrit-plugins","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/","title":{"rendered":"How to compile and build Gerrit Plugins?"},"content":{"rendered":"<p><strong>To build Gerrit Plugins from source, you need:<\/strong><\/p>\n<p>A Linux or macOS system (Windows is not supported at this time)<\/p>\n<p><strong>zip, unzip, wget<\/strong><\/p>\n<pre>$yum install zip -y\r\n$ yum install unzip -y\r\n$ yum install wget -y\r\n$ yum install git -y<\/pre>\n<p><strong>Python 2 or 3<\/strong><br \/>\nThis is installed in each RHEL 7 and Ubunutu server by defaul.<\/p>\n<p><strong>Node.js<\/strong><\/p>\n<pre>curl --silent --location https:\/\/rpm.nodesource.com\/setup_8.x | sudo bash -\r\nOR\r\ncurl --silent --location https:\/\/rpm.nodesource.com\/setup_10.x | sudo bash -\r\nsudo yum -y install nodejs<\/pre>\n<p><strong>Bazel<\/strong><\/p>\n<pre>## RHEL\/CentOS 7 64-Bit ##\r\n$ wget https:\/\/copr.fedorainfracloud.org\/coprs\/vbatts\/bazel\/repo\/epel-7\/vbatts-bazel-epel-7.repo\r\n$ cp vbatts-bazel-epel-7.repo \/etc\/yum.repos.d\/\r\n$ yum install -y bazel<\/pre>\n<p><strong>How to Installing Bazel on Ubuntu?<\/strong><br \/>\nhttps:\/\/docs.bazel.build\/versions\/master\/install-ubuntu.html<\/p>\n<p><strong>Maven<\/strong><\/p>\n<pre>\r\n$ cd \/opt\r\n$ wget http:\/\/www-us.apache.org\/dist\/maven\/maven-3\/3.5.4\/binaries\/apache-maven-3.5.4-bin.zip\r\n$ unzip apache-maven-3.5.4-bin.zip\r\n$ mv apache-maven-3.5.4 maven\r\n$ export PATH=$PATH:\/op\/maven\/bin<\/pre>\n<p><strong>gcc<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ sudo yum install gcc-c++ make<\/pre>\n<p><strong>Now, Bazel in tree driven means it can only be built from within Gerrit tree. Clone or link the plugin into gerrit\/plugins directory:<\/strong><\/p>\n<p><strong># First become a non-root user<\/strong><\/p>\n<p><strong>A JDK for Java 8<\/strong><\/p>\n<pre>\r\n$ cd\r\n$ wget -c --header \"Cookie: oraclelicense=accept-securebackup-cookie\" http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/8u181-b13\/96a7b8442fe848ef90c96a2fad6ed6d1\/jdk-8u181-linux-x64.tar.gz\r\n$ tar -xvf jdk-8u181-linux-x64.tar.gz\r\n$ export JAVA_HOME=\/home\/ec2-user\/jdk1.8.0_181\r\n$ java -version\r\n<\/pre>\n<p><strong>Follow for Gerrit.war<\/strong><\/p>\n<pre>\r\n$ git clone --recursive https:\/\/gerrit.googlesource.com\/gerrit\r\n$ cd gerrit \r\n$ bazel build release\r\n<\/pre>\n<p><strong>Follow for plugins such as\u00a0its-jira<\/strong><\/p>\n<pre>\r\n$ cd plugins\r\n$ git clone https:\/\/gerrit.googlesource.com\/plugins\/its-jira\r\n$ git clone https:\/\/gerrit.googlesource.com\/plugins\/its-base\r\n$ bazel build plugins\/its-jira\r\n<\/pre>\n<p><strong>The output can be normally found in the following directory:<\/strong><\/p>\n<pre>bazel-genfiles\/plugins\/its-jira\/its-jira.jar<\/pre>\n<p># Some plugins describe their build process in src\/main\/resources\/Documentation\/build.md file. It may worth checking.<\/p>\n<p># Some plugins cane be build using maven as well<\/p>\n<p><strong>Reference<\/strong><\/p>\n<ul>\n<li>https:\/\/gerrit-review.googlesource.com\/Documentation\/dev-bazel.html<\/li>\n<li>https:\/\/gerrit.googlesource.com\/gerrit\/<\/li>\n<li>https:\/\/gerrit-review.googlesource.com\/Documentation\/cmd-plugin-install.html<\/li>\n<li>https:\/\/gerrit-review.googlesource.com\/Documentation\/dev-build-plugins.html<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>To build Gerrit Plugins from source, you need: A Linux or macOS system (Windows is not supported at this time) [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4994],"tags":[5007,91,3420,945,1076],"class_list":["post-5171","post","type-post","status-publish","format-standard","hentry","category-gerrit","tag-bazel","tag-build","tag-compile","tag-gerrit","tag-plugins"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to compile and build Gerrit Plugins? - scmGalaxy<\/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:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to compile and build Gerrit Plugins? - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"To build Gerrit Plugins from source, you need: A Linux or macOS system (Windows is not supported at this time) [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-19T20:09:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-27T09:07:01+00:00\" \/>\n<meta name=\"author\" content=\"scmgalaxy K\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"scmgalaxy K\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-compile-and-build-gerrit-plugins\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-compile-and-build-gerrit-plugins\\\/\"},\"author\":{\"name\":\"scmgalaxy K\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\"},\"headline\":\"How to compile and build Gerrit Plugins?\",\"datePublished\":\"2018-08-19T20:09:20+00:00\",\"dateModified\":\"2021-02-27T09:07:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-compile-and-build-gerrit-plugins\\\/\"},\"wordCount\":178,\"commentCount\":0,\"keywords\":[\"Bazel\",\"Build\",\"Compile\",\"Gerrit\",\"Plugins\"],\"articleSection\":[\"Gerrit\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-compile-and-build-gerrit-plugins\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-compile-and-build-gerrit-plugins\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-compile-and-build-gerrit-plugins\\\/\",\"name\":\"How to compile and build Gerrit Plugins? - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2018-08-19T20:09:20+00:00\",\"dateModified\":\"2021-02-27T09:07:01+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-compile-and-build-gerrit-plugins\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-compile-and-build-gerrit-plugins\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-compile-and-build-gerrit-plugins\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to compile and build Gerrit Plugins?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\",\"name\":\"scmgalaxy K\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"caption\":\"scmgalaxy K\"},\"sameAs\":[\"http:\\\/\\\/www.DevOpsSchool.com\"],\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/scmgalaxy\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to compile and build Gerrit Plugins? - scmGalaxy","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:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/","og_locale":"en_US","og_type":"article","og_title":"How to compile and build Gerrit Plugins? - scmGalaxy","og_description":"To build Gerrit Plugins from source, you need: A Linux or macOS system (Windows is not supported at this time) [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/","og_site_name":"scmGalaxy","article_published_time":"2018-08-19T20:09:20+00:00","article_modified_time":"2021-02-27T09:07:01+00:00","author":"scmgalaxy K","twitter_card":"summary_large_image","twitter_misc":{"Written by":"scmgalaxy K","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/"},"author":{"name":"scmgalaxy K","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102"},"headline":"How to compile and build Gerrit Plugins?","datePublished":"2018-08-19T20:09:20+00:00","dateModified":"2021-02-27T09:07:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/"},"wordCount":178,"commentCount":0,"keywords":["Bazel","Build","Compile","Gerrit","Plugins"],"articleSection":["Gerrit"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/","name":"How to compile and build Gerrit Plugins? - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"datePublished":"2018-08-19T20:09:20+00:00","dateModified":"2021-02-27T09:07:01+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-compile-and-build-gerrit-plugins\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"How to compile and build Gerrit Plugins?"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102","name":"scmgalaxy K","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","caption":"scmgalaxy K"},"sameAs":["http:\/\/www.DevOpsSchool.com"],"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/scmgalaxy\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=5171"}],"version-history":[{"count":14,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5171\/revisions"}],"predecessor-version":[{"id":5202,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5171\/revisions\/5202"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=5171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=5171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=5171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}