1
votes

I tried to set up an internal remote repository for our organization and want to use that repository as a mirror.

  1. I setup repository manager using Artifactory.
  2. I used once of the default local repository "libs-release-local" as my remote repo.
  3. As it will not connect to any central repos to resolve artifacts (even I need this behavior as my server can not connect internet), I deployed all artifacts manually from my local repository following below steps

    1. open Deploy tab on my artifactory web-ui
    2. click on Artifacts Bundle
    3. browse .zip file of my repo
    4. click on upload.

    artifacts deployed successfully and I'm able to browse those form UI.

  4. Now i'm using this repo as mirror in my settings.xml

     <mirrors>
         <mirror>
           <id>internal</id>
                <url>http://localhost:8081/artifactory/libs-release-local</url>
           <mirrorOf>external:*</mirrorOf>
         </mirror>
      </mirrors>
    
  5. I tried to build my project using target mvn clean package

Now I'm getting Error:

Return code is: 503 , ReasonPhrase:Service Unavailable

Error log:

[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for o rg.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to internal (http://localhost:8081/artifactory/libs-release-local): Failed to transfer file: http://localhost:8081/artifactory/libs-release-local/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom. Return code is: 503 , ReasonPhrase:Service Unavailable. -> [Help 1]

If I user the same URL(localhost:8081/artifactory/libs-release-local/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom ) in web browser it is downloading artifact.

settings.xml

<settings 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/settings-1.0.0.xsd">

<proxies>
     <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
       <username>proxy_user</username>
      <password>proxy_password</password>
      <host>proxy_name</host>
      <port>8080</port>
     </proxy>
</proxies>   

<mirrors>
    <mirror>
      <id>internal</id>
      <url>http://localhost:8081/artifactory/libs-release-local</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
</mirrors>
</settings> 

What am I missing?

1
Are you running Maven on the same machine as Artifactory? is your browser configured to use a proxy? can you share your full settings.xml?Dror Bereznitsky
Yes I'm running Maven on same machine that's why I'm using "localhost". yes my browser is configured to use proxy. same proxy I configured in my setting.xml. I'm sharing my full setting.xml belowsuman t

1 Answers

4
votes

The problem is with your proxy settings. The current settings will cause all requests to localhost to go through the proxy which will not be able to connect with localhost and hence returns a 503.
To solve this issue add the following to the proxy settings in the settings.xml file:

<nonProxyHosts>localhost</nonProxyHosts>