2017-02-05 38 views
0

中に実行されていない私はここでおよそGradle build lifecycleA Gradleのタスク(タイプ:Execの)構成フェーズ

を読んでいる私のスクリプトです:

task startTomcat(type:Exec) { 
    commandLine 'cmd', '/c', 'echo init startTomcat' 
} 

task stopTomcat(type:Exec) { 

    // on windows: 
    commandLine 'cmd', '/c', 'echo init stopTomcat!' 
    doLast { 
     commandLine 'cmd', '/c', 'echo doLast stopTomcat!' 
    } 
} 


task configured(type:Exec) { 
    println 'configured. method body' 
} 

task test2 { 
    doLast { 
     println 'test2 doLast' 
    } 
} 

task testBoth2 { 
    doFirst { 
     println 'testBoth2 doFirst' 
    } 
    doLast { 
     println 'testBoth2 doLast' 
    } 
    println 'testBoth2. method body' 
} 

私はタスク2を実行します。

gradlew test2 

これは出力です:

Parallel execution with configuration on demand is an incubating feature. 
configured. method body 
testBoth2. method body 
:test2 
test2 doLast 

BUILD SUCCESSFUL 

commandLineへの呼び出しが無視されたようです。どうして?

答えて

3

ExectaskcommandLineは適切にのみタスクが実行される場合にどうするかを設定します。したがって、設定フェーズでは何もしない実際のコマンドが表示されます。

関連する問題