[ 
https://issues.apache.org/jira/browse/WAGON-421?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Osipov updated WAGON-421:
---------------------------------
    Fix Version/s: 2.6

> "Not authorized" when deploying artifact following HTTP redirect
> ----------------------------------------------------------------
>
>                 Key: WAGON-421
>                 URL: https://issues.apache.org/jira/browse/WAGON-421
>             Project: Maven Wagon
>          Issue Type: Bug
>          Components: wagon-http
>    Affects Versions: 2.4, 2.5, 2.6, 2.7
>         Environment: Maven 3.0.4+
>            Reporter: Bruno Medeiros
>            Assignee: Robert Scholte
>            Priority: Critical
>             Fix For: 2.6
>
>
> I always deployed artifacts to my repository without problems, until last 
> week when I was forced to migrate my repository to a different URL. I still 
> have control of the old domain, so I set a redirect in Apache on the old 
> domain, like this:
>  bq.   Redirect permanent /maven2 http://newsubdomain.company.com/maven2
> Deploys works perfect with the old URL for maven 2.2.1 and 3.0.3, but all 
> maven 3.0.4+ are broken (even 3.1.1 and 3.2.3). Here follows my test:
> #> ~/apache-maven-3.2.3/bin/mvn -X deploy
> error (full stacktrace):
> {code}
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on 
> project jcompany_flex_util: Failed to retrieve remote metadata 
> br.com.company:jcompany_flex_util:0.4.0-SNAPSHOT/maven-metadata.xml: Could 
> not transfer metadata 
> br.com.company:jcompany_flex_util:0.4.0-SNAPSHOT/maven-metadata.xml from/to 
> company-repo (http://dev.company.com.br:80/maven2/libs-snapshots-local): Not 
> authorized , ReasonPhrase:Unauthorized. -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
> goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy 
> (default-deploy) on project jcompany_flex_util: Failed to retrieve remote 
> metadata br.com.company:jcompany_flex_util:0.4.0-SNAPSHOT/maven-metadata.xml: 
> Could not transfer metadata 
> br.com.company:jcompany_flex_util:0.4.0-SNAPSHOT/maven-metadata.xml from/to 
> company-repo (http://dev.company.com.br:80/maven2/libs-snapshots-local): Not 
> authorized , ReasonPhrase:Unauthorized.
>       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
>       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>       at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
>       at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
>       at 
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
>       at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
>       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
>       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
>       at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
>       at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
>       at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to retrieve 
> remote metadata 
> br.com.company:jcompany_flex_util:0.4.0-SNAPSHOT/maven-metadata.xml: Could 
> not transfer metadata 
> br.com.company:jcompany_flex_util:0.4.0-SNAPSHOT/maven-metadata.xml from/to 
> company-repo (http://dev.company.com.br:80/maven2/libs-snapshots-local): Not 
> authorized , ReasonPhrase:Unauthorized.
>       at 
> org.apache.maven.plugin.deploy.DeployMojo.deployProject(DeployMojo.java:284)
>       at 
> org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:169)
>       at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
>       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
>       ... 19 more
> Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: 
> Failed to retrieve remote metadata 
> br.com.company:jcompany_flex_util:0.4.0-SNAPSHOT/maven-metadata.xml: Could 
> not transfer metadata 
> br.com.company:jcompany_flex_util:0.4.0-SNAPSHOT/maven-metadata.xml from/to 
> company-repo (http://dev.company.com.br:80/maven2/libs-snapshots-local): Not 
> authorized , ReasonPhrase:Unauthorized.
>       at org.apache.maven.artifact.deployer.DefaultArtifactDto isolate 
> thateployer.deploy(DefaultArtifactDeployer.java:143)
>       at 
> org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy(AbstractDeployMojo.java:171)
>       at 
> org.apache.maven.plugin.deploy.DeployMojo.deployProject(DeployMojo.java:250)
>       ... 22 more
> Caused by: org.eclipse.aether.deployment.DeploymentException: Failed to 
> retrieve remote metadata 
> br.com.company:jcompany_flex_util:0.4.0-SNAPSHOT/maven-metadata.xml: Could 
> not transfer metadata 
> br.com.company:jcompany_flex_util:0.4.0-SNAPSHOT/maven-metadata.xml from/to 
> company-repo (http://dev.company.com.br:80/maven2/libs-snapshots-local): Not 
> authorized , ReasonPhrase:Unauthorized.
>       at 
> org.eclipse.aether.internal.impl.DefaultDeployer.upload(DefaultDeployer.java:463)
>       at 
> org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:313)
>       at 
> org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:268)
>       at 
> org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:413)
>       at 
> org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:139)
>       ... 24 more
> Caused by: org.eclipse.aether.transfer.MetadataTransferException: Could not 
> transfer metadata 
> br.com.company:jcompany_flex_util:0.4.0-SNAPSHOT/maven-metadata.xml from/to 
> company-repo (http://dev.company.com.br:80/maven2/libs-snapshots-local): Not 
> authorized , ReasonPhrase:Unauthorized.
>       at 
> org.eclipse.aether.connector.wagon.WagonRepositoryConnector$5.wrap(WagonRepositoryConnector.java:995)
>       at 
> org.eclipse.aether.connector.wagon.WagonRepositoryConnector$5.wrap(WagonRepositoryConnector.java:983)
>       at 
> org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:725)
>       at 
> org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>       at java.lang.Thread.run(Thread.java:745)
> Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Not 
> authorized , ReasonPhrase:Unauthorized.
>       at 
> org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:876)
>       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.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:660)
>       ... 4 more
> {code}
> I also played with some settings os the new wagon, as described in 
> http://maven.apache.org/guides/mini/guide-http-settings.html, but none of 
> them helped.
> If I use maven 3.0.3 on the same environment, with the same project and 
> settings.xml, everything works fine. 
> Everything also works fine if I use the new URL, but editing all my pom's 
> deployment descriptors in all branches and tags of all projects is unfeasible.
> I can help providing a test case, but it requires an specific server setup 
> and I don't know how you deal with this kind of test. Please tell me if you 
> have similar tests so I can provide one covering this case.
> Obs: This issue seems related somehow to WAGON-369, there is a comment there 
> talking about something similar to this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to