1

tl;dr:

gradle-vfs プラグインで使用されるように https プロキシを設定するにはどうすればよいですか? 通常の Java/gradle プロキシ構成を無視しているようです。

全詳細

このgradle ファイルに基づいて、私は gradle を使用して asciidoc から 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 が失敗します。

: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".

cp47 行目は、このブロック内の で始まる最初の行です。

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
    }
}
4

1 に答える 1

1

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のドキュメントから派生したものです。

于 2016-05-25T10:20:47.807 に答える