构建:
task taskX() << {
println 'taskX'
}
task taskY(type:Copy) << {
println "taskY"
}
输出:
C:\dev\how-to-confluence\NYSSIS-WS\ear>gradlew -q taskX
taskX
C:\dev\how-to-confluence\NYSSIS-WS\ear>gradlew -q taskY
C:\dev\how-to-confluence\NYSSIS-WS\ear>gradlew -version
------------------------------------------------------------
Gradle 2.10
------------------------------------------------------------
Build time: 2015-12-21 21:15:04 UTC
Build number: none
Revision: 276bdcded730f53aa8c11b479986aafa58e124a6
Groovy: 2.4.4
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.7.0_67 (Oracle Corporation 24.65-b04)
OS: Windows 7 6.1 amd64
注意: taskY中的println调用不输出。
答案 0 :(得分:0)
为了提供文件实际上是复制的反馈,我需要利用复制任务中可用的eachFile closure。
task taskX() << {
println 'taskX'
}
task taskY(type:Copy) {
eachFile{
println "taskY"
}
from 'src/main' into 'build'
}