Maven - reduce time taken for remote repository access
<p>My project uses hibernate-spatial package. Following is the entry from pom.xml file</p>

<pre><code>&lt;repositories&gt;
    &lt;repository&gt;
        &lt;id&gt;Hibernate Spatial repo&lt;/id&gt;
        &lt;url&gt;http://www.hibernatespatial.org/repository&lt;/url&gt;
    &lt;/repository&gt;
&lt;/repositories&gt;
...
&lt;dependency&gt;
    &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
    &lt;artifactId&gt;hibernate-spatial&lt;/artifactId&gt;
    &lt;version&gt;4.0&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>

<p>When I do <code>mvn clean install</code>, maven tries to access the remote repository which doesn't exist anymore. Following is the message I see in the console log.</p>

<blockquote>
  <p>Downloading: <a href="http://www.hibernatespatial.org/repository/_project" rel="nofollow noreferrer">http://www.hibernatespatial.org/repository/_project</a>
  _related_info/maven-metadata.xml Nov 24, 2016 9:34:20 AM
  org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec
  execute INFO: I/O exception (java.net.SocketException) caught when
  processing request to {}-><a href="http://www.hibernatespatial.org:80" rel="nofollow noreferrer">http://www.hibernatespatial.org:80</a>:
  Operation timed out Nov 24, 2016 9:34:20 AM
  org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec
  execute INFO: Retrying request to
  {}-><a href="http://www.hibernatespatial.org:80" rel="nofollow noreferrer">http://www.hibernatespatial.org:80</a> Nov 24, 2016 9:35:23 AM
  org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec
  execute INFO: I/O exception (java.net.SocketException) caught when
  processing request to {}-><a href="http://www.hibernatespatial.org:80" rel="nofollow noreferrer">http://www.hibernatespatial.org:80</a>:
  Operation timed out Nov 24, 2016 9:35:23 AM
  org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec
  execute INFO: Retrying request to
  {}-><a href="http://www.hibernatespatial.org:80" rel="nofollow noreferrer">http://www.hibernatespatial.org:80</a> [WARNING] Could not transfer
  metadata _project_related_info/maven-metadata.xml from/to Hibernate
  Spatial repo (<a href="http://www.hibernatespatial.org/repository" rel="nofollow noreferrer">http://www.hibernatespatial.org/repository</a>): Connect to
  www.hibernatespatial.org:80 [www.hibernatespatial.org/62.213.201.148]
  failed: Operation timed out</p>
</blockquote>

<p>Actually the package is available inside my <code>~/.m2/repository</code> folder. So after multiple timeouts maven looks in the local repository, finds it there and build succeeds. How can I reduce the time taken for remote repository checking.</p>

<p>I try to put the following into my <code>~/.m2/settings.xml</code> file but it didn't help.</p>

<pre><code>&lt;server&gt;
  &lt;id&gt;central&lt;/id&gt;
  &lt;configuration&gt;
    &lt;httpConfiguration&gt;
      &lt;all&gt;
        &lt;connectionTimeout&gt;5000&lt;/connectionTimeout&gt;
        &lt;readTimeout&gt;5000&lt;/readTimeout&gt;
      &lt;/all&gt;
    &lt;/httpConfiguration&gt;
  &lt;/configuration&gt;
&lt;/server&gt;
</code></pre>

<p></p>