Maven: “Error reading archetype catalog”, NOT behind a Proxy

前端 未结 3 835
旧巷少年郎
旧巷少年郎 2020-12-29 11:57

Command:

mvn archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false -DgroupId=org.apache.solr -DartifactId=es-my-proj
         


        
3条回答
  •  没有蜡笔的小新
    2020-12-29 12:18

    I got the same error yesterday. I didn't finish to find the solution yet but I have a idea why we have this errror.

    After hours of digging in the maven-archetype-plugin, I didn't notice something strange...

    So i decide to run the same command again with a tcpflow running to capture the sended request. Here is the result :

    192.168.000.010.59775-185.031.016.185.00080: GET /maven2/archetype-catalog.xml HTTP/1.1
    Cache-control: no-cache
    Cache-store: no-store
    Pragma: no-cache
    Expires: 0
    Accept-Encoding: gzip
    Host: repo1.maven.org
    Connection: Keep-Alive
    
    
    185.031.016.185.00080-192.168.000.010.59775: HTTP/1.1 403 Denied Access
    Server: Varnish
    Retry-After: 0
    Content-Type: text/html; charset=utf-8
    Content-Length: 401
    Accept-Ranges: bytes
    Date: Fri, 30 Aug 2013 01:53:29 GMT
    Via: 1.1 varnish
    Age: 0
    Connection: close
    X-Served-By: cache-am70-AMS
    X-Cache: MISS
    X-Cache-Hits: 0
    

    So, a Guru Meditation error. I like Varnish !! After that, I notice using netcat that, if you add a User-Agent (anything) in the request, everything works fine !!

    [07:49][patouche@patouche-desktop:~ :) ] $ nc repo1.maven.org 80
    GET /maven2/archetype-catalog.xml HTTP/1.1
    Cache-control: no-cache
    Cache-store: no-store
    Pragma: no-cache
    Expires: 0
    Accept-Encoding: gzip
    Host: repo1.maven.org
    Connection: Keep-Alive
    User-Agent: I have a dream...
    
    HTTP/1.1 200 OK
    Server: nginx/1.2.1
    Content-Type: text/xml
    Last-Modified: Tue, 27 Aug 2013 11:06:25 GMT
    Via: 1.1 varnish
    Content-Length: 1663366
    Accept-Ranges: bytes
    Date: Fri, 30 Aug 2013 05:50:09 GMT
    Via: 1.1 varnish
    Age: 81998
    Connection: keep-alive
    X-Served-By: cache-c32-CHI, cache-l22-LON
    X-Cache: HIT, HIT
    X-Cache-Hits: 5, 1
    

    So, if you add a User-Agent in the request, everything will work. I thinks with the settings.xml but I don't know how for now.

提交回复
热议问题