title: Maven cannot download from Artifactory Repository
body: <p>I am attempting to connect our Jenkins servers to our Artifactory repository for builds. I've been successful with the Jenkins server at my office location, but I am having problems with a Jenkins server that's on another part of the corporate network.</p>
  
  <p>I've disabled the job, went into the workspace, and tried using <code>mvn</code> directly:</p>
  
  <pre><code>$ mvn clean
  [INFO] Scanning for projects...
  [INFO] ------------------------------------------------------------------------
  [INFO] Reactor Build Order:
  [INFO] 
  [INFO] PROJ Generic Aggregate POM
  [INFO] PROJ Generic Module
  [INFO] PROJ Generic Features
  [INFO]                                                                         
  [INFO] ------------------------------------------------------------------------
  [INFO] Building PROJ Generic Aggregate POM 1.0.0-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  Downloading: http://repo.vegicorp.net/artifactory/plugins-release/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
  </code></pre>
  
  <p>And then it freezes before it spits out:</p>
  
  <pre><code>[INFO] ------------------------------------------------------------------------
  [INFO] Reactor Summary:
  [INFO] 
  [INFO] PROJ Generic Aggregate POM ........................ FAILURE [2:06.295s]
  [INFO] PROJ Generic Module ............................... SKIPPED
  [INFO] PROJ Generic Features ............................. SKIPPED
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 2:07.160s
  [INFO] Finished at: Wed Feb 11 18:16:46 EST 2015
  [INFO] Final Memory: 8M/149M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo.vegicorp.net/artifactory/plugins-release): Connection to http://repo.vegicorp.net refused: Connection timed out -&gt; [Help 1]
  [ERROR] 
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
  to
  </code></pre>
  
  <p>However, if I attempt to fetch that URL via <code>curl</code>, it downloads without any problems. Same with <code>wget</code>:</p>
  
  <pre><code>$ curl http://repo.vegicorp.net/artifactory/plugins-release/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
  &lt;?xml version='1.0' encoding='UTF-8'?&gt;
  
  &lt;!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
  
    http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
  --&gt;
  
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  </code></pre>
  
  <p>So, I am able to reach that URL via <code>wget</code> and <code>curl</code>, but Maven itself seems to be having problems fetching that URL. I've added a <code>proxy</code> settings to my <code>~/.m2/settings.xml</code>, but that doesn't seem to make any difference. We originally setup our Maven repository to redirect from Port 80 to Port 8080, but adding or removing the port number from the URL makes no difference. The <code>settings.xml</code> is from Artifactory which will generate it for you. The same <code>settings.xml</code> works in our office.</p>
  
  <p>Removing the <code>settings.xml</code> allows everything to work because it can download from the standard Maven repo.</p>
  
  <p>My <code>settings.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;servers&gt;
      &lt;server&gt;
        &lt;username&gt;dweintraub&lt;/username&gt;
        &lt;password&gt;AP8SoMtGnYpACsAwZo5oqUCfSYP&lt;/password&gt;
        &lt;id&gt;central&lt;/id&gt;
      &lt;/server&gt;
      &lt;server&gt;
        &lt;username&gt;dweintraub&lt;/username&gt;
        &lt;password&gt;AP8SoMtGnYpACsAwZo5oqUCfSYP&lt;/password&gt;
        &lt;id&gt;snapshots&lt;/id&gt;
      &lt;/server&gt;
    &lt;/servers&gt;
    &lt;profiles&gt;
      &lt;profile&gt;
        &lt;repositories&gt;
          &lt;repository&gt;
            &lt;snapshots&gt;
              &lt;enabled&gt;false&lt;/enabled&gt;
            &lt;/snapshots&gt;
            &lt;id&gt;central&lt;/id&gt;
            &lt;name&gt;libs-release&lt;/name&gt;
            &lt;url&gt;http://repo.vegicorp.net/artifactory/libs-release&lt;/url&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
            &lt;snapshots /&gt;
            &lt;id&gt;snapshots&lt;/id&gt;
            &lt;name&gt;libs-snapshot&lt;/name&gt;
            &lt;url&gt;http://repo.vegicorp.net/artifactory/libs-snapshot&lt;/url&gt;
          &lt;/repository&gt;
        &lt;/repositories&gt;
        &lt;pluginRepositories&gt;
          &lt;pluginRepository&gt;
            &lt;snapshots&gt;
              &lt;enabled&gt;false&lt;/enabled&gt;
            &lt;/snapshots&gt;
            &lt;id&gt;central&lt;/id&gt;
            &lt;name&gt;plugins-release&lt;/name&gt;
            &lt;url&gt;http://repo.vegicorp.net/artifactory/plugins-release&lt;/url&gt;
          &lt;/pluginRepository&gt;
          &lt;pluginRepository&gt;
            &lt;snapshots /&gt;
            &lt;id&gt;snapshots&lt;/id&gt;
            &lt;name&gt;plugins-snapshot&lt;/name&gt;
            &lt;url&gt;http://repo.vegicorp.net/artifactory/plugins-snapshot&lt;/url&gt;
          &lt;/pluginRepository&gt;
        &lt;/pluginRepositories&gt;
        &lt;id&gt;artifactory&lt;/id&gt;
      &lt;/profile&gt;
    &lt;/profiles&gt;
    &lt;activeProfiles&gt;
      &lt;activeProfile&gt;artifactory&lt;/activeProfile&gt;
    &lt;/activeProfiles&gt;
  &lt;/settings&gt;
  </code></pre>
  
  <p>And there's a file <code>~/.m2/repositories/org/apache/maven/plugins/maven-clean-plugins/2.4.1/maven-clean-plugin-2.4.1.pom.lastUpdated</code> with this content:</p>
  
  <pre><code>#NOTE: This is an internal implementation file, its format can be changed without prior notice.
  #Wed Feb 11 18:16:46 EST 2015
  da39a3ee5e6b4b0d3255bfef95601890afd80709@proxy.gain.tcprod.local\:3128&gt;2f606e371a64780e100321226a9f68a38c8b7906@default-http\://repo.vegicorp.net/artifactory/plugins-release/.lastUpdated=1423695463870
  2f606e371a64780e100321226a9f68a38c8b7906@default-http\://repo.vegicorp.net/artifactory/plugins-release/.lastUpdated=1423696543392
  http\://repo.vegicorp.net/artifactory/plugins-release/.error=Could not transfer artifact org.apache.maven.plugins\:maven-clean-plugin\:pom\:2.4.1 from/to central (http\://repo.vegicorp.net/artifactory/plugins-release)\: Connection to http\://repo.vegicorp.net refused
  http\://repo.fusesource.com/nexus/content/repositories/releases/.lastUpdated=1423694766347
  http\://repo.vegicorp.net/artifactory/plugins-snapshot/.error=Could not transfer artifact org.apache.maven.plugins\:maven-clean-plugin\:pom\:2.4.1 from/to snapshots (http\://repo.vegicorp.net/artifactory/plugins-snapshot)\: Connection to http\://repo.vegicorp.net refused
  2f606e371a64780e100321226a9f68a38c8b7906@default-http\://repo.vegicorp.net/artifactory/plugins-snapshot/.lastUpdated=1423696606400
  http\://repo.fusesource.com/nexus/content/repositories/releases/.error=
  http\://repo.vegicorp.net/artifactory/plugins-release/.error=Could not transfer artifact org.apache.maven.plugins\:maven-clean-plugin\:pom\:2.4.1 from/to central (http\://repo.vegicorp.net/artifactory/plugins-release)\: Failed to transfer file\: http\://repo.vegicorp.net/artifactory/plugins-release/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom. Return code is\: 504 , ReasonPhrase\:Gateway Time-out.
  </code></pre>
  
  <blockquote>
    <p>That looks like a proxy settings problem. Can you please add the ouptut of mvn help:effective-settings to the question? Thanks! </p>
  </blockquote>
  
  <p>I'm going to cry...</p>
  
  <pre><code>$ mvn help:effective-settings
  [INFO] Scanning for projects...
  [INFO] ------------------------------------------------------------------------
  [INFO] Reactor Build Order:
  [INFO] 
  [INFO] PROJ Generic Aggregate POM
  [INFO] PROJ Generic Module
  [INFO] PROJ Generic Features
  Downloading: http://repo.fusesource.com/nexus/content/repositories/releases/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
  Downloading: http://repo.vegicorp.net/artifactory/plugins-release/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
  </code></pre>
  
  <p>and then it freezes and displays:</p>
  
  <pre><code>[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
  </code></pre>
  
  <p>Sorry. I can't run <code>mvn help:effective-settings</code> because of my settings...</p>