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

前端 未结 3 825
旧巷少年郎
旧巷少年郎 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:01

    It seems like Apache central repository has fixed the issue. So without making any change, the problem is fixed now. Please try once again and let us know in case of any issue.

    0 讨论(0)
  • 2020-12-29 12:05

    The Apache Maven team faced the same issue with one of their integration-tests, see the related message-thread. So it seems that during the last week of August the policy has changed and it is not possible to get these xml files without a User-Agent in the request. There's no option in the Maven Settings to set this value, neither have I found another way to set it.

    I can confirm that Maven-3.0.4 does work, but this version has a security issue. According to other posts other older versions of Maven seem to work as well.

    Unless Maven Central changes its policy, this is something which needs to be fixed in the next Maven release.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题