nice unit test
now hack AbstractHttpClientWagon.setHeaders to add a User-Agent header:
method.addHeader( "User-Agent", "test" );
and it works:
- >> "GET /maven2/junit/junit/maven-metadata.xml HTTP/1.1[\r][\n]"
- >> "Cache-control: no-cache[\r][\n]"
- >> "Cache-store: no-store[\r][\n]"
- >> "Pragma: no-cache[\r][\n]"
- >> "Expires: 0[\r][\n]"
- >> "Accept-Encoding: gzip[\r][\n]"
- >> "User-Agent: test[\r][\n]"
- >> "Host: repo.maven.apache.org[\r][\n]"
- >> "Connection: Keep-Alive[\r][\n]"
- >> "[\r][\n]"
- << "HTTP/1.1 200 OK[\r][\n]"
- << "Server: nginx/1.2.1[\r][\n]"
- << "Content-Type: text/xml[\r][\n]"
- << "Last-Modified: Wed, 14 Nov 2012 19:24:17 GMT[\r][\n]"
- << "Via: 1.1 varnish[\r][\n]"
- << "Content-Length: 884[\r][\n]"
- << "Accept-Ranges: bytes[\r][\n]"
- << "Date: Sat, 31 Aug 2013 15:04:10 GMT[\r][\n]"
- << "Via: 1.1 varnish[\r][\n]"
- << "Age: 414111[\r][\n]"
- << "Connection: keep-alive[\r][\n]"
- << "X-Served-By: cache-c48-CHI, cache-am71-AMS[\r][\n]"
- << "X-Cache: HIT, HIT[\r][\n]"
- << "X-Cache-Hits: 1374, 1007[\r][\n]"
- << "[\r][\n]"
seems like central repo now requires User-Agent setting
Regards,
Hervé
Le samedi 31 août 2013 16:24:05 Robert Scholte a écrit :
> I'm not sure if this testcase does exactly the same thing, but the results
> are the same: failure due to an Access Denied error.
>
>
> ---
> package org.apache.maven.wagon.providers.http;
>
> import org.apache.maven.wagon.InputData;
> import org.apache.maven.wagon.repository.Repository;
> import org.apache.maven.wagon.resource.Resource;
> import org.junit.Test;
>
> public class AbstractHttpClientWagonTest
> {
>
> @Test
> public void test()
> throws Exception
> {
> AbstractHttpClientWagon wagon = new AbstractHttpClientWagon()
> {
> };
>
> Repository repository = new Repository( "central",
> "http://repo.maven.apache.org/maven2" );
>
> wagon.connect( repository );
>
> Resource resource = new Resource();
>
> resource.setName( "junit/junit/maven-metadata.xml" );
>
> InputData inputData = new InputData();
>
> inputData.setResource( resource );
>
> wagon.fillInputData( inputData );
> }
> }
>
> 2013-08-31 16:18:16,723 [main] DEBUG org.apache.http.headers - >> GET
> /maven2/junit/junit/maven-metadata.xml HTTP/1.1
> 2013-08-31 16:18:16,726 [main] DEBUG org.apache.http.headers - >>
> Cache-control: no-cache
> 2013-08-31 16:18:16,726 [main] DEBUG org.apache.http.headers - >>
> Cache-store: no-store
> 2013-08-31 16:18:16,726 [main] DEBUG org.apache.http.headers - >> Pragma:
> no-cache
> 2013-08-31 16:18:16,726 [main] DEBUG org.apache.http.headers - >>
> Expires: 0
> 2013-08-31 16:18:16,726 [main] DEBUG org.apache.http.headers - >>
> Accept-Encoding: gzip
> 2013-08-31 16:18:16,726 [main] DEBUG org.apache.http.headers - >> Host:
> repo.maven.apache.org
> 2013-08-31 16:18:16,726 [main] DEBUG org.apache.http.headers - >>
> Connection: Keep-Alive
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - <<
> HTTP/1.1 403 Denied Access
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - << Server:
> Varnish
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - <<
> Retry-After: 0
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - <<
> Content-Type: text/html; charset=utf-8
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - <<
> Content-Length: 401
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - <<
> Accept-Ranges: bytes
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - << Date:
> Sat, 31 Aug 2013 14:18:19 GMT
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - << Via:
> 1.1 varnish
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - << Age: 0
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - <<
> Connection: close
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - <<
> X-Served-By: cache-am71-AMS
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - <<
> X-Cache: MISS
> 2013-08-31 16:18:16,747 [main] DEBUG org.apache.http.headers - <<
> X-Cache-Hits: 0
> ---
>
> Robert
>
> Op Sat, 31 Aug 2013 16:00:51 +0200 schreef Hervé BOUTEMY
>
> <[email protected]>:
> > it was merged with wagon-http-shared when working on WAGON-388
> >
> > Regards,
> >
> > Hervé
> >
> > Le samedi 31 août 2013 14:51:31 Robert Scholte a écrit :
> >> Where are the sources of wagon-http-shared4?
> >>
> >> I don't see them here:
> >>
> >> https://git-wip-us.apache.org/repos/asf/maven-wagon.git/?p=maven-wagon.gi
> >> t;a
> >> =tree;f=wagon-providers;h=1b6502eff9db183e9a72b44efff7fe5e0cb8da23;hb=HE
> >> AD
> >>
> >> Robert
> >>
> >>
> >> Op Sat, 31 Aug 2013 13:29:37 +0200 schreef Robert Scholte
> >>
> >> <[email protected]>:
> >> > Recently I noticed several threads at Stackoverflow mentioning the
> >>
> >> same
> >>
> >> > exception.
> >> >
> >> > I've tried it with the following version (in this order):
> >> > M3.1.0 > failed
> >> > M3.0.4 > success
> >> > M3.0.5 > success
> >> > M3.1.0 > success
> >> >
> >> > So I changed the updatePolicy of the central repository to 'always'.
> >> > Now it still succeeds, but the log shows me the access denied
> >>
> >> exception
> >>
> >> > again.
> >> > My conclusion: Maven falls back to the file available in the local
> >>
> >> repo.
> >>
> >> > I thought it was an infrastructure issue at Maven Central, but it
> >>
> >> seems
> >>
> >> > wagon-related.
> >> >
> >> > Robert
> >> >
> >> > Op Sat, 31 Aug 2013 11:51:05 +0200 schreef Hervé BOUTEMY
> >> >
> >> > <[email protected]>:
> >> >> Really strange
> >> >> I can reproduce m-doap-p IT failures from my machine but not
> >> >> m-eclipse-p ones
> >> >>
> >> >> notice in m-doap-p IT, the url should get a 404 not found
> >> >> but in m-eclipse-p IT, the url points to existing content
> >> >>
> >> >> IMHO, the behaviour change between Maven versions is tied to MNG-5175
> >> >> change
> >> >> from wagon-http-lightweight to wagon-http
> >> >> But this doesn't explain the change in time: could it be related to
> >> >> changes in
> >> >> Maven central protection rules? Something about user-agents, to avoid
> >> >> scrapers?
> >> >>
> >> >> We should try to look at what's happening on the wire, to check exact
> >> >> http
> >> >> request+reply during the IT
> >> >> Anybody with experience on such an investigation?
> >> >>
> >> >> Regards,
> >> >>
> >> >> Hervé
> >> >>
> >> >> Le vendredi 30 août 2013 17:26:36 Robert Scholte a écrit :
> >> >>> The failing IT for the m-eclipse-p has a similar issue:
> >> >>>
> >> >>> When trying to resolve the following dependency:
> >> >>> <dependency>
> >> >>>
> >> >>> <groupId>junit</groupId>
> >> >>> <artifactId>junit</artifactId>
> >> >>> <version>[3.0,3.8.1]</version>
> >> >>>
> >> >>> </dependency>
> >> >>>
> >> >>> it logs the following exception:
> >> >>>
> >> >>> [WARNING] repository metadata for: 'artifact junit:junit' could not
> >>
> >> be
> >>
> >> >>> retrieved from repository: central due to an error: Authorization
> >> >>> failed:
> >> >>> Access denied to:
> >> >>> http://repo.maven.apache.org/maven2/junit/junit/maven-metadata.xml ,
> >> >>> ReasonPhrase:Denied Access.
> >> >>> [DEBUG] Exception
> >> >>> org.apache.maven.wagon.TransferFailedException: Authorization
> >>
> >> failed:
> >> >>> Access denied to:
> >> >>> http://repo.maven.apache.org/maven2/junit/junit/maven-metadata.xml ,
> >> >>> ReasonPhrase:Denied Access.
> >> >>>
> >> >>> at
> >>
> >> org.apache.maven.repository.legacy.DefaultWagonManager.getRemoteFile(Def
> >>
> >> >>> ault WagonManager.java:442) at
> >>
> >> org.apache.maven.repository.legacy.DefaultWagonManager.getArtifactMetada
> >>
> >> >>> ta(D efaultWagonManager.java:206) at
> >>
> >> org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataM
> >>
> >> >>> anag er.resolve(DefaultRepositoryMetadataManager.java:132) at
> >>
> >> org.apache.maven.project.artifact.MavenMetadataSource.retrieveAvailableV
> >>
> >> >>> ersi ons(MavenMetadataSource.java:435) at
> >>
> >> org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollect
> >>
> >> >>> or.r ecurse(DefaultLegacyArtifactCollector.java:497) at
> >>
> >> org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollect
> >>
> >> >>> or.c ollect(DefaultLegacyArtifactCollector.java:144) at
> >>
> >> org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollect
> >>
> >> >>> or.c ollect(DefaultLegacyArtifactCollector.java:100) at
> >>
> >> org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollect
> >>
> >> >>> or.c ollect(DefaultLegacyArtifactCollector.java:782) at
> >>
> >> org.apache.maven.plugin.ide.AbstractIdeSupportMojo.doDependencyResolutio
> >>
> >> >>> n(Ab stractIdeSupportMojo.java:559) at
> >>
> >> org.apache.maven.plugin.ide.AbstractIdeSupportMojo.execute(AbstractIdeSu
> >>
> >> >>> ppor tMojo.java:506) at
> >>
> >> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBui
> >>
> >> >>> ldPl uginManager.java:106) at
> >>
> >> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.ja
> >>
> >> >>> va:2 08) at
> >>
> >> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.ja
> >>
> >> >>> va:1 53) at
> >>
> >> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.ja
> >>
> >> >>> va:1 45) at
> >>
> >> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(
> >>
> >> >>> Life cycleModuleBuilder.java:84) at
> >>
> >> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(
> >>
> >> >>> Life cycleModuleBuilder.java:59) at
> >>
> >> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild
> >>
> >> >>> (Lif ecycleStarter.java:183) at
> >>
> >> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleSt
> >>
> >> >>> arte r.java:161) at
> >> >>> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318) at
> >> >>> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
> >> >>>
> >> >>> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
> >> >>> 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.jav
> >>
> >> >>> a:39 ) at
> >>
> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> >>
> >> >>> Impl .java:25) at java.lang.reflect.Method.invoke(Method.java:597)
> >> >>>
> >> >>> at
> >>
> >> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launche
> >>
> >> >>> r.ja va:290) at
> >>
> >> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:2
> >>
> >> >>> 30)
> >> >>>
> >> >>> at
> >>
> >> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launc
> >>
> >> >>> her. java:414) at
> >>
> >> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357
> >>
> >> >>> )
> >>
> >> >>> Caused by:
> >> org.apache.maven.wagon.authorization.AuthorizationException:
> >> >>> Access denied to:
> >> >>> http://repo.maven.apache.org/maven2/junit/junit/maven-metadata.xml ,
> >> >>> ReasonPhrase:Denied Access.
> >> >>>
> >> >>> at
> >>
> >> org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputDat
> >>
> >> >>> a(Ab stractHttpClientWagon.java:928) 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.repository.legacy.DefaultWagonManager.getRemoteFile(Def
> >>
> >> >>> ault WagonManager.java:351) ... 30 more
> >> >>>
> >> >>>
> >> >>> Op Thu, 29 Aug 2013 18:46:21 +0200 schreef Kristian Rosenvold
> >> >>>
> >> >>> <[email protected]>:
> >> >>> > I see on Jenkins, that the IT's on the DOAP plugin fail once we
> >>
> >> pass
> >>
> >> >>> > maven 3.0.3. I extracted the following from the build.log file.
> >> >>>
> >> >>> Anyone
> >> >>>
> >> >>> > know what issue this is, and what workaround/fix might be applied
> >>
> >> ?
> >>
> >> >>> > Kristian
> >> >>> >
> >> >>> >
> >> >>> > ------------------
> >> >>> >
> >> >>> > GroupId: org.apache.maven.its.doap
> >> >>> > ArtifactId: maven-it-plugin
> >>
> >> >>> > Metadata Type:
> >> org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata
> >>
> >> >>> > could not be retrieved from repositories due to an error:
> >> repository
> >>
> >> >>> > metadata for: 'artifact org.apache.maven.its.doap:maven-it-plugin'
> >> >>> > could not be retrieved from repository: central due to an error:
> >>
> >> >>> > Authorization failed: Access denied to:
> >> http://repo.maven.apache.org/maven2/org/apache/maven/its/doap/maven-it-p
> >>
> >> >>> lu
> >> >>>
> >> >>> > gin/maven-metadata.xml , ReasonPhrase:Denied Access.
> >> >>> >
> >> >>> > at
> >>
> >> org.apache.maven.plugin.doap.DoapMojo.writeReleases(DoapMojo.java:1461)
> >>
> >> >>> > at
> >>
> >> org.apache.maven.plugin.doap.DoapMojo.writeDoapFile(DoapMojo.java:730)
> >>
> >> >>> > at
> >> >>> >
> >> >>> > org.apache.maven.plugin.doap.DoapMojo.execute(DoapMojo.java:443)
> >> >>> >
> >> >>> > at
> >>
> >> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBui
> >>
> >> >>> ld
> >> >>>
> >> >>> > PluginManager.java:106)>
> >> >>> >
> >> >>> > at
> >>
> >> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.ja
> >>
> >> >>> va
> >> >>>
> >> >>> > :208)>
> >> >>> > :
> >> >>> > ... 19 more
> >> >>> >
> >> >>> > Caused by:
> >> org.apache.maven.artifact.repository.metadata.RepositoryMetadataResoluti
> >>
> >> >>> on
> >> >>>
> >> >>> > Exception: repository metadata for: 'artifact
> >> >>> > org.apache.maven.its.doap:maven-it-plugin' could not be retrieved
> >> >>>
> >> >>> from
> >> >>>
> >> >>> > repository: central due to an error: Authorization failed: Access
> >>
> >> >>> > denied to:
> >> http://repo.maven.apache.org/maven2/org/apache/maven/its/doap/maven-it-p
> >>
> >> >>> lu
> >> >>>
> >> >>> > gin/maven-metadata.xml , ReasonPhrase:Denied Access.
> >> >>> >
> >> >>> > at
> >>
> >> org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataM
> >>
> >> >>> an
> >> >>>
> >> >>> > ager.resolveAlways(DefaultRepositoryMetadataManager.java:397)>
> >> >>> >
> >> >>> > at
> >>
> >> org.apache.maven.plugin.doap.DoapMojo.writeReleases(DoapMojo.java:1456)
> >>
> >> >>> > ... 23 more
> >> >>> >
> >> >>> > Caused by: org.apache.maven.wagon.TransferFailedException:
> >> >>> > Authorization failed: Access denied to:
> >> http://repo.maven.apache.org/maven2/org/apache/maven/its/doap/maven-it-p
> >>
> >> >>> lu
> >> >>>
> >> >>> > gin/maven-metadata.xml , ReasonPhrase:Denied Access.
> >> >>> >
> >> >>> > at
> >>
> >> org.apache.maven.repository.legacy.DefaultWagonManager.getRemoteFile(Def
> >>
> >> >>> au
> >> >>>
> >> >>> > ltWagonManager.java:442)>
> >> >>> >
> >> >>> > at
> >>
> >> org.apache.maven.repository.legacy.DefaultWagonManager.getArtifactMetada
> >>
> >> >>> ta
> >> >>>
> >> >>> > FromDeploymentRepository(DefaultWagonManager.java:215)>
> >> >>> >
> >> >>> > at
> >>
> >> org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataM
> >>
> >> >>> an
> >>
> >> ager.getArtifactMetadataFromDeploymentRepository(DefaultRepositoryMetada
> >>
> >> >>> ta
> >> >>>
> >> >>> > Manager.java:421)>
> >> >>> >
> >> >>> > at
> >>
> >> org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataM
> >>
> >> >>> an
> >> >>>
> >> >>> > ager.resolveAlways(DefaultRepositoryMetadataManager.java:393)>
> >> >>> >
> >> >>> > ... 24 more
> >> >>> >
> >> >>> > Caused by:
> >> >>> > org.apache.maven.wagon.authorization.AuthorizationException:
> >> Access
> >>
> >> >>> > denied to:
> >> http://repo.maven.apache.org/maven2/org/apache/maven/its/doap/maven-it-p
> >>
> >> >>> lu
> >> >>>
> >> >>> > gin/maven-metadata.xml , ReasonPhrase:Denied Access.
> >> >>> >
> >> >>> > at
> >>
> >> org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputDat
> >>
> >> >>> a(
> >> >>>
> >> >>> > AbstractHttpClientWagon.java:928)>
> >> >>> >
> >> >>> > 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.repository.legacy.DefaultWagonManager.getRemoteFile(Def
> >>
> >> >>> au
> >> >>>
> >> >>> > ltWagonManager.java:351)>
> >> >>> >
> >> >>> > ... 27 more
> >> >>> >
> >> >>> > [ERROR]
> >>
> >> ---------------------------------------------------------------------
> >>
> >> >>> > To unsubscribe, e-mail: [email protected]
> >> >>> > For additional commands, e-mail: [email protected]
> >>
> >> ---------------------------------------------------------------------
> >>
> >> >>> To unsubscribe, e-mail: [email protected]
> >> >>> For additional commands, e-mail: [email protected]
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: [email protected]
> >> >> For additional commands, e-mail: [email protected]
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: [email protected]
> >> > For additional commands, e-mail: [email protected]
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]