rajesh
(rajesh.eq)
1
Is there a gradle command equivalent to ant uptodate task?
I tried using ant command inside gradle but it is not working as expected. Don’t know what is wrong below
task abc << {
boolean works
ant.uptodate(property: “works”, srcfile: “$rootDir/target/1.txt”, targetfile: “$rootDir/target/dum/1.txt”)
println works }
Ant properties aren’t variables.
You need to get the value a different way.
task abc << {
ant.uptodate(property: "works", srcfile: "$rootDir/target/1.txt", targetfile: "$rootDir/target/dum/1.txt")
println ant.properties.works
}
rajesh
(rajesh.eq)
3
Thanks. It works now in task abc. But If I use the ant.uptodate inside a custom task, ant.properties.works prints null instead of true.
String rootDir = project.rootDir.getPath() @TaskAction def abc(){
ant.uptodate(property: “works”, srcfile: “$rootDir/target/1.txt”, targetfile: “$rootDir/target/dum/1.txt”)
println ant.properties.works
}
rajesh
(rajesh.eq)
4
Worked for me using ‘ant.antProject.properties.works’
println ant.antProject.properties.works