asciidoctor / asciidoctor-gradle-examples

A collection of example projects that demonstrates how to use the Asciidoctor Gradle plugin
http://asciidoctor.github.io/asciidoctor-gradle-examples
Other
146 stars 132 forks source link

asciidoc-to-deckjs-example:download failed #14

Open franck-serot opened 9 years ago

franck-serot commented 9 years ago

Hi, I try to compile asciidoctor-gradle-examples but I have the following error. Could you please help me ? Best regards, Franck

:asciidoc-diagram-to-html-example:jrubyPrepareGems UP-TO-DATE :asciidoc-diagram-to-html-example:asciidoctor :asciidoc-to-all-example:asciidoctor UP-TO-DATE :asciidoc-to-deckjs-example:download FAILED

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 1 mins 28.441 secs

franck-serot commented 9 years ago

The problem is on line 39 of 'D:\workshop\asciidoc\asciidoctor-gradle-examples\asciidoc-to-deckjs-example\build.gradle' with the copy of https://github.com/asciidoctor/asciidoctor-deck.js/archive/${asciidoctorBackendVersion}.zip and extract of directory asciidoctor-deck.js-${asciidoctorBackendVersion}/templates.

I can download with a browser the file https://github.com/asciidoctor/asciidoctor-deck.js/archive/${asciidoctorBackendVersion}.zip.

franck-serot commented 9 years ago

In fact, the problem is the proxy of my company. I can build without problem at home.

How can we configure a proxy in the following task ?

task download << { mkdir downloadDir vfs { cp "zip:https://github.com/asciidoctor/asciidoctor-deck.js/archive/${asciidoctorBackendVersion}.zip!asciidoctor-deck.js-${asciidoctorBackendVersion}/templates", templateDir, recursive:true, overwrite:true cp "zip:https://github.com/imakewebthings/deck.js/archive/${deckjsVersion}.zip!deck.js-${deckjsVersion}", deckjsDir, recursive:true, overwrite:true } }

jforge commented 9 years ago

I'm facing a similar issue with revealjs.

Proxy settings are documented here: https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy

If this doesn't work, this one could help (in this case: a local squid proxy): gradlew -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3129

And if this doesn't help, maybe this snippet for build.gradle could help (taken from the web):

task setHttpProxyFromEnv {
   def map = ['HTTP_PROXY': 'http', 'HTTPS_PROXY': 'https']
   for (e in System.getenv()) {
      def key = e.key.toUpperCase()
      if (key in map) {
         def base = map[key]
         def url = e.value.toURL()
        println " - systemProp.${base}.proxy=${url.host}:${url.port}"
        System.setProperty("${base}.proxyHost", url.host.toString())
        System.setProperty("${base}.proxyPort", url.port.toString())
      }
   }
}
build.dependsOn setHttpProxyFromEnv

(you may replace the map keys with your OS' sys env proxy settings)