2016-05-13 109 views
1

TL配置代理; DR:爲gradle這個-VFS插件

如何配置HTTPS代理由gradle這個-VFS插件來使用?它似乎忽略了正常的java/gradle代理配置。

全部詳細

在此基礎上gradle file我嘗試使用gradle這個從asciidocs創建reveal.js幻燈片。

我已經配置使用與內容類似下面的gradle.properties文件中的代理服務器設置:

systemProp.http.proxyHost=myproxy 
systemProp.http.proxyPort=8080 
systemProp.http.nonProxyHosts=localhost 
systemProp.https.proxyHost=myproxy 
systemProp.https.proxyPort=8080 
systemProp.https.nonProxyHosts=localhost 

儘管此配置適用於gradle這個時候執行的Java構建(它下載插件和依賴性),VFS這在參考生成文件用於失敗:47

:download FAILED 

FAILURE: Build failed with an exception. 

* Where: 
Build file 'D:\workspaces\myproject\build.gradle' line: 47 

* What went wrong: 
Execution failed for task ':download'. 
> Could not connect to HTTP server on "github.com". 

線是在該塊中的第一年初cp

task download << { 
    mkdir downloadDir 
    vfs { 
     cp "zip:https://github.com/asciidoctor/asciidoctor-reveal.js/archive/${asciidoctorBackendVersion}.zip!asciidoctor-reveal.js-${asciidoctorBackendVersion}", 
      templateDir, recursive:true, overwrite:true 
     cp "zip:https://github.com/hakimel/reveal.js/archive/${revealjsVersion}.zip!reveal.js-${revealjsVersion}", 
      revealjsDir, recursive:true, overwrite:true 
    } 
} 

回答

1

一個(我的)解決方案是添加定義代理參數的vfs選項。 這可能更復雜,例如通過建立一個任務來獲得從系統環境參數,但是這一個工程:

task download << { mkdir downloadDir vfs { options 'vfs.http.proxyHost' : 'mylocalsquid.lokal' options 'vfs.http.proxyPort' : '3128' options 'vfs.https.proxyHost' : 'mylocalsquid.lokal' options 'vfs.https.proxyPort' : '3128' cp "zip:https://github.com/asciidoctor/asciidoctor-reveal.js/archive/${asciidoctorBackendVersion}.zip!asciidoctor-reveal.js-${asciidoctorBackendVersion}", templateDir, recursive:true, overwrite:true cp "zip:https://github.com/hakimel/reveal.js/archive/${revealjsVersion}.zip!reveal.js-${revealjsVersion}", revealjsDir, recursive:true, overwrite:true } }

這是從文檔的http://ysb33r.github.io/groovy-vfs/1.0/docs/product-documentation.html

+1

導出到使用gradle.properties定義的屬性可以替代帶有project.property(「systemProp.http.proxyPort」)的字符串文字,其中字符串是屬性的名稱。 –