akhikhl / wuff

Gradle plugin for automating assembly of OSGi/Eclipse bundles and applications
MIT License
153 stars 51 forks source link

HTTP 407 when downloading eclipse-jee-luna-SR2-win32-x86_64.zip #77

Open hacksst opened 9 years ago

hacksst commented 9 years ago

When trying to execute a build using wuff I'm facing following error:

Failed to notify project evaluation listener. Server returned HTTP response code: 407 for URL: http://mirror.netcologne.de/eclipse//technology/epp/downloads/release/luna/SR2/eclipse-jee-luna-SR2-win32-x86_64.zip

It seems that wuff does not recognize my proxy settings defined in gradle.poperties. Resolving the dependencies from the central repository works, therefore the proxy settings seem to be correct.

The Stracktrace cause is:

Caused by: java.io.IOException: Server returned HTTP response code: 407 for URL: http://mirror.netcologne.de/eclipse//te chnology/epp/downloads/release/luna/SR2/eclipse-jee-luna-SR2-win32-x86_64.zip at java_net_URL$openStream$2.call(Unknown Source) at org.akhikhl.unpuzzle.utils.Downloader.downloadFile(Downloader.groovy:81) at org.akhikhl.unpuzzle.utils.Downloader$downloadFile.call(Unknown Source) at org.akhikhl.unpuzzle.eclipse2maven.EclipseDownloader.downloadAndUnpack(EclipseDownloader.groovy:63) at org.akhikhl.unpuzzle.eclipse2maven.EclipseDownloader$downloadAndUnpack.call(Unknown Source) at org.akhikhl.unpuzzle.Configurer.downloadEclipse(Configurer.groovy:114) at org.akhikhl.unpuzzle.Configurer$downloadEclipse$3.callCurrent(Unknown Source) at org.akhikhl.unpuzzle.Configurer.installEclipse(Configurer.groovy:149) at org.akhikhl.unpuzzle.Configurer$installEclipse$2.call(Unknown Source) at org.akhikhl.wuff.Configurer.getSelectedEclipseMavenGroup(Configurer.groovy:166) at org.akhikhl.wuff.Configurer.postConfigure(Configurer.groovy:217) at org.akhikhl.wuff.JavaConfigurer.super$2$postConfigure(JavaConfigurer.groovy) at org.akhikhl.wuff.JavaConfigurer.postConfigure(JavaConfigurer.groovy:91) at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40) at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25) at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:87) ... 34 more

And the simple build script:

buildscript { repositories { mavenLocal() jcenter() } dependencies { classpath 'org.akhikhl.wuff:wuff-plugin:+' } } apply plugin: 'org.akhikhl.wuff.eclipse-bundle'

hacksst commented 9 years ago

I resolved the issue by changing

org.akhikhl.unpuzzle.utils.Downloader.downloadFile(URL url, File file)

The root cause seemed to be that a connection and a stream are opened on the URL and the stream was not closed. What I did is open a connection once and reuse it for creating the stream. Furthermore I added the Proxy-Authorization Property to the connection, but only when Java System Properties http.proxyPassword and http.ProxyUser are configured.

I'm gonna try to commit the fix to https://github.com/akhikhl/unpuzzle soon.