How to force empty directories when copying a file tree using gradle 0.8?

Using Gradle 0.8, I have the following file structure

source/
  stuff/
    file.txt
  empty/

Who do I want to copy to create

target/
  stuff/
    file.txt
  empty/

So, I tried this:

  def sourceTree = fileTree(dir: 'source')
  def targetDir = file(dir: 'target')

  copy {
    from sourceTree 
    into targetDir
  }

But instead, I get:

target/
  stuff/
    file.txt

How to force empty directories?

+3
source share
1 answer

I have a wild hunch, but you can try

def sourceTree = fileTree(dir: 'source').include('**/*')
-1
source

Source: https://habr.com/ru/post/1724990/


All Articles