1

Gretty のドキュメントに示されているように、Gretty のポートを変更しようとしているときに問題が発生しました。

Gradle appRunWar -PhttpPort=8888 

それが機能する唯一の方法は、build.gradle gretty ブロックを変更することです

gretty {
    http = 8888
    contextPath = '/'
}
4

1 に答える 1

1

Gretty Possible Running Build in Different Ports Github リポジトリを検索した後、解決策を見つけました。

build.gradle ファイルを次のように変更するだけです。

gretty {
    httpPort = project.hasProperty("httpPort") ? project.httpPort as int : 8080
    contextPath = '/'
}

これを行う別の方法は、次を追加することです

gradle.taskGraph.whenReady {
    graph ->
        if (project.hasProperty("httpPort")) {
            gretty.httpPort = httpPort as int
        }
}

どちらのソリューションも、プロパティ引数をギルド ファイルに渡すことで機能します。

 gradle -PhttpPort=8888 
于 2016-02-15T03:12:42.053 に答える