The only way to enforce that your doFirst {} action always runs is to disable
the up-to-date check (mycopy.outputs.upToDateWhen { false }). But then you
will lose that feature. Alternatively you can use a global callback (e.g.
gradle.taskGraph.whenReady {}) and handle the situation that the task is
scheduled to run but the directory doesn't exist there.-- Peter Niederwieser Principal Engineer, Gradleware http://gradleware.com Creator, Spock Framework http://spockframework.org Twitter: @pniederw markusbischof wrote > > Hi forum, > > I have a copy-task which copies some files. I would like the task to fail > if the source directory does not exist. How can I achieve this? I tried > the following: > > task MYCOPY(type: Copy) { > doFirst { > assert DIRECTORY.exists() > } > from DIRECTORY > into someotherfolder > } > > but if the DIRECTORY does not exist, the task is "uptodate". Is there a > flag for the copy task to perform a check on the source directory? > > Any help is appreciated! > > Markus > -- View this message in context: http://gradle.1045684.n5.nabble.com/Copy-with-non-existing-source-directory-tp5067547p5075052.html Sent from the gradle-user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
