{"version":"https://jsonfeed.org/version/1.1","title":"Jaryl Chng's Knowledge Base","home_page_url":"https://kb.jarylchng.com","feed_url":"https://kb-jarylchng-com.pages.dev/json/","description":"<p>Welcome to the index page of my knowledge base, if you haven't done so, do visit my website at <a href=\"https://jarylchng.com\" rel=\"noopener noreferrer\" target=\"_blank\">https://jarylchng.com</a>.</p><p>I will mainly use this site to document stuff, most of which will likely be in the public domain.</p>","icon":"https://kb-static.jarylchng.com/kb-jarylchng-com/production/images/channel-c68f1f55f856ab833b4365991609dbec.png","favicon":"https://kb-static.jarylchng.com/kb-jarylchng-com/production/images/favicon-b94914f57599a477f9f72dab6bc71001.png","authors":[{"name":"Jaryl Chng"}],"language":"en-us","items":[{"id":"DAeWYjb1OU2","title":"Java - Downloading Maven Dependencies as a Local Repository for Offline Build and Usage","url":"https://kb.jarylchng.com/i/java-downloading-maven-dependencies-as-a-local-r-DAeWYjb1OU2/","content_html":"<p>I had a scenario where in a Jenkins slave machine while configuring CI/CD, it was not allowed to access the internet to download Maven dependencies due to restrictions. Hence, I had to find a way to download the remote repositories of only required files to a local repository and push it along with the codes and map pom.xml to use it.</p><h2>Instructions</h2><h3>1. Download offline repository of only required dependencies into a file path</h3><p>Run command in project root directory:</p><pre class=\"ql-syntax\" spellcheck=\"false\">mvn dependency:go-offline -Dmaven.repo.local=./repo\n</pre><h3>2. Map pom.xml</h3><p>Bottom of pom.xml:</p><pre class=\"ql-syntax\" spellcheck=\"false\">&lt;repositories&gt;\n    &lt;repository&gt;\n        &lt;id&gt;offline&lt;/id&gt;\n        &lt;name&gt;Offline Repository&lt;/name&gt;\n        &lt;url&gt;file://${project.basedir}/repo&lt;/url&gt;\n    &lt;/repository&gt;\n&lt;/repositories&gt;\n&lt;pluginRepositories&gt;\n    &lt;pluginRepository&gt;\n        &lt;id&gt;offline&lt;/id&gt;\n        &lt;name&gt;Offline Repository&lt;/name&gt;\n        &lt;url&gt;file://${project.basedir}/repo&lt;/url&gt;\n    &lt;/pluginRepository&gt;\n&lt;/pluginRepositories&gt;\n</pre><p>As simple as that.</p>","content_text":"I had a scenario where in a Jenkins slave machine while configuring CI/CD, it\nwas not allowed to access the internet to download Maven dependencies due to\nrestrictions. Hence, I had to find a way to download the remote repositories of\nonly required files to a local repository and push it along with the codes and\nmap pom.xml to use it.\n\n\nINSTRUCTIONS\n\n\n1. DOWNLOAD OFFLINE REPOSITORY OF ONLY REQUIRED DEPENDENCIES INTO A FILE PATH\n\nRun command in project root directory:\n\nmvn dependency:go-offline -Dmaven.repo.local=./repo\n\n\n\n2. MAP POM.XML\n\nBottom of pom.xml:\n\n<repositories>\n    <repository>\n        <id>offline</id>\n        <name>Offline Repository</name>\n        <url>file://${project.basedir}/repo</url>\n    </repository>\n</repositories>\n<pluginRepositories>\n    <pluginRepository>\n        <id>offline</id>\n        <name>Offline Repository</name>\n        <url>file://${project.basedir}/repo</url>\n    </pluginRepository>\n</pluginRepositories>\n\n\nAs simple as that.","date_published":"2024-04-06T16:17:33.711Z","_microfeed":{"web_url":"https://kb-jarylchng-com.pages.dev/i/java-downloading-maven-dependencies-as-a-local-r-DAeWYjb1OU2/","json_url":"https://kb-jarylchng-com.pages.dev/i/DAeWYjb1OU2/json/","rss_url":"https://kb-jarylchng-com.pages.dev/i/DAeWYjb1OU2/rss/","guid":"DAeWYjb1OU2","status":"published","itunes:episodeType":"full","date_published_short":"Sat Apr 06 2024","date_published_ms":1712420253711}}],"_microfeed":{"microfeed_version":"0.1.2","base_url":"https://kb-jarylchng-com.pages.dev","categories":[{"name":"Technology"}],"subscribe_methods":[{"name":"RSS","type":"rss","url":"https://kb-jarylchng-com.pages.dev/rss/","image":"https://kb-jarylchng-com.pages.dev/assets/brands/subscribe/rss.png","enabled":true,"editable":false,"id":"sQbXXExV58H"},{"name":"JSON","type":"json","url":"https://kb-jarylchng-com.pages.dev/json/","image":"https://kb-jarylchng-com.pages.dev/assets/brands/subscribe/json.png","enabled":true,"editable":false,"id":"nC8cjLCnOOi"}],"description_text":"Welcome to the index page of my knowledge base, if you haven't done so, do visit\nmy website at https://jarylchng.com.\n\nI will mainly use this site to document stuff, most of which will likely be in\nthe public domain.","copyright":"©2024","itunes:type":"episodic","items_sort_order":"newest_first"}}