You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jesse Glick (JIRA)" <ji...@codehaus.org> on 2010/09/17 00:41:32 UTC

[jira] Created: (MNG-4816) Maven 3 fails to follow 301 redirects

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

        

[jira] Closed: (MNG-4816) Maven 3 fails to follow 301 redirects

Posted by "Jesse Glick (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-4816?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse Glick closed MNG-4816.
----------------------------

    Resolution: Duplicate

> 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

        

[jira] Commented: (MNG-4816) Maven 3 fails to follow 301 redirects

Posted by "Jesse Glick (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-4816?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=235626#action_235626 ] 

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

Complete test case, for reference (works in M2 and fails in M3):

{noformat}
rm -rf ~/.m2/repository/org/codehaus/mojo/archetypes test-MNG-4816
mvn -DarchetypeVersion=1.1 -Darchetype.interactive=false -DgroupId=test -DarchetypeArtifactId=webapp-javaee6 -DarchetypeRepository=http://repository.codehaus.org -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.codehaus.mojo.archetypes -Dpackage=test -DartifactId=test-MNG-4816 --batch-mode --debug org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-5:generate
{noformat}

> 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

        

[jira] Commented: (MNG-4816) Maven 3 fails to follow 301 redirects

Posted by "Jesse Glick (JIRA)" <ji...@codehaus.org>.
    [ 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