<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="/rss/stylesheet/" type="text/xsl"?>
<rss xmlns:content='http://purl.org/rss/1.0/modules/content/' xmlns:taxo='http://purl.org/rss/1.0/modules/taxonomy/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:itunes='http://www.itunes.com/dtds/podcast-1.0.dtd' xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:atom='http://www.w3.org/2005/Atom' xmlns:podbridge='http://www.podbridge.com/podbridge-ad.dtd' version='2.0'>
<channel>
  <title>Jaryl Chng&apos;s Knowledge Base</title>
  <language>en-us</language>
  <generator>microfeed.org</generator>
  <itunes:type>episodic</itunes:type>
  <itunes:explicit>false</itunes:explicit>
  <atom:link rel="self" href="https://kb-jarylchng-com.pages.dev/rss/" type="application/rss+xml"/>
  <link>https://kb.jarylchng.com</link>
  <description>
    <![CDATA[<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>]]>
  </description>
  <itunes:author>Jaryl Chng</itunes:author>
  <itunes:image href="https://kb-static.jarylchng.com/kb-jarylchng-com/production/images/channel-c68f1f55f856ab833b4365991609dbec.png"/>
  <image>
    <title>Jaryl Chng&apos;s Knowledge Base</title>
    <url>https://kb-static.jarylchng.com/kb-jarylchng-com/production/images/channel-c68f1f55f856ab833b4365991609dbec.png</url>
    <link>https://kb.jarylchng.com</link>
  </image>
  <copyright>©2024</copyright>
  <itunes:category text="Technology"/>
  <item>
    <title>Java - Downloading Maven Dependencies as a Local Repository for Offline Build and Usage</title>
    <guid>DAeWYjb1OU2</guid>
    <pubDate>Sat, 06 Apr 2024 16:17:33 GMT</pubDate>
    <itunes:explicit>false</itunes:explicit>
    <description>
      <![CDATA[<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
</pre><h3>2. Map pom.xml</h3><p>Bottom of pom.xml:</p><pre class="ql-syntax" spellcheck="false">&lt;repositories&gt;
    &lt;repository&gt;
        &lt;id&gt;offline&lt;/id&gt;
        &lt;name&gt;Offline Repository&lt;/name&gt;
        &lt;url&gt;file://${project.basedir}/repo&lt;/url&gt;
    &lt;/repository&gt;
&lt;/repositories&gt;
&lt;pluginRepositories&gt;
    &lt;pluginRepository&gt;
        &lt;id&gt;offline&lt;/id&gt;
        &lt;name&gt;Offline Repository&lt;/name&gt;
        &lt;url&gt;file://${project.basedir}/repo&lt;/url&gt;
    &lt;/pluginRepository&gt;
&lt;/pluginRepositories&gt;
</pre><p>As simple as that.</p>]]>
    </description>
    <link>https://kb.jarylchng.com/i/java-downloading-maven-dependencies-as-a-local-r-DAeWYjb1OU2/</link>
    <itunes:episodeType>full</itunes:episodeType>
  </item>
</channel>
</rss>