[ 
http://jira.codehaus.org/browse/MNG-4816?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=235623#action_235623
 ] 

Jesse Glick commented on MNG-4816:
----------------------------------

Actually a bit more complicated than I thought. The artifact is also apparently 
available in Central (i.e. the command would have worked in any Maven version 
if no alternate repository were specified). M3 tries to get it from Codehaus 
first (as requested), and misinterprets the 301 as the actual file, as 
described in MNG-4428:

{code}
...
Downloading: 
http://repository.codehaus.org/org/codehaus/mojo/archetypes/webapp-javaee6/1.1/webapp-javaee6-1.1.jar
Downloaded: 
http://repository.codehaus.org/org/codehaus/mojo/archetypes/webapp-javaee6/1.1/webapp-javaee6-1.1.jar
 (425 B at 0.9 KB/sec)
...
[DEBUG] Found archetype org.codehaus.mojo.archetypes:webapp-javaee6:1.1 in 
cache: 
~/.m2/repository/org/codehaus/mojo/archetypes/webapp-javaee6/1.1/webapp-javaee6-1.1.jar
[ERROR] Failed to close zipFile
{code}

M2 (both 2.2.0 and 2.2.1, contrary to MNG-4428 which claims a regression in 
2.2.1!) fails to get the artifact from Codehaus at all, but falls back 
correctly to Central:

{code}
...
Downloading: 
http://repository.codehaus.org/org/codehaus/mojo/archetypes/webapp-javaee6/1.1/webapp-javaee6-1.1.jar
[DEBUG] 
http://repository.codehaus.org/org/codehaus/mojo/archetypes/webapp-javaee6/1.1/webapp-javaee6-1.1.jar
 - Status code: 404
[DEBUG] File: 
http://repository.codehaus.org/org/codehaus/mojo/archetypes/webapp-javaee6/1.1/webapp-javaee6-1.1.jar
 does not exist
org.apache.maven.wagon.ResourceDoesNotExistException: File: 
http://repository.codehaus.org/org/codehaus/mojo/archetypes/webapp-javaee6/1.1/webapp-javaee6-1.1.jar
 does not exist
    at 
org.apache.maven.wagon.shared.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:603)
    at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
    at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
    at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
    at 
org.apache.maven.artifact.manager.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:491)
...
[INFO] Unable to find resource 
'org.codehaus.mojo.archetypes:webapp-javaee6:jar:1.1' in repository 
webapp-javaee6-repo (http://repository.codehaus.org)
[DEBUG] Trying repository central
[DEBUG] Checking for pre-existing User-Agent configuration.
[DEBUG] Adding User-Agent configuration.
[DEBUG] Connecting to repository: 'central' with url: 
'http://repo1.maven.org/maven2'.
Downloading: 
http://repo1.maven.org/maven2/org/codehaus/mojo/archetypes/webapp-javaee6/1.1/webapp-javaee6-1.1.jar
[DEBUG] 
http://repo1.maven.org/maven2/org/codehaus/mojo/archetypes/webapp-javaee6/1.1/webapp-javaee6-1.1.jar
 - Status code: 200
...
{code}

This is odd, as curl confirms that the Codehaus server sends a 301 redirect, 
not a 404. So in addition to known redirect handling bug in M3, there appears 
to also be some transport bug in M2.

> Maven 3 fails to follow 301 redirects
> -------------------------------------
>
>                 Key: MNG-4816
>                 URL: http://jira.codehaus.org/browse/MNG-4816
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Artifacts and Repositories
>    Affects Versions: 3.0-beta-3
>         Environment: JDK 6u21, Ubuntu.
>            Reporter: Jesse Glick
>
> See https://netbeans.org/bugzilla/show_bug.cgi?id=190033 for steps to 
> reproduce, and in particular delete 
> ~/.m2/repository/org/codehaus/mojo/archetypes/webapp-javaee6/1.1/webapp-javaee6-1.1.jar
>  first. Maven 2.2.1 works; 3.0-beta-3 fails. The difference is that M3 tries 
> to download this JAR but the HTTP transport does not handle redirects, so the 
> JAR file in the local repo is actually a text file:
> {code}
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <html><head>
> <title>301 Moved Permanently</title>
> </head><body>
> <h1>Moved Permanently</h1>
> <p>The document has moved <a 
> href="https://nexus.codehaus.org/content/repositories/releases/org/codehaus/mojo/archetypes/webapp-javaee6/1.1/webapp-javaee6-1.1.jar";>here</a>.</p>
> <hr>
> <address>Apache/2.0.52 (Red Hat) Server at repository.codehaus.org Port 
> 80</address>
> </body></html>
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to