0

There is my task:

task fatJar(type: Jar) {
    exclude {
        it.name.startsWith('assets')
    }
    from 'build/tmp/hello' // assets/application.css
}

I want to exclude assets directory from my source code and add assets directory from build/tmp/hello path, but exclude filter prevent it, how to solve this issue?

mystdeim
  • 4,802
  • 11
  • 49
  • 77
  • Possible duplicate of [Gradle 1.2: Exclude directory under resources sourceSets](http://stackoverflow.com/questions/12617827/gradle-1-2-exclude-directory-under-resources-sourcesets) – Andrii Abramov Jan 11 '17 at 10:02

1 Answers1

1

Something like this should work:

task fatJar(type: Jar) {
    exclude 'assets'
    from ('build/tmp/hello/assets') {
        into 'assets'
    }
}
Henry
  • 42,982
  • 7
  • 68
  • 84
  • But I get warning with this code: Configuring child specs of a copy task at execution time of the task has been deprecated and is scheduled to be removed in Gradle 4.0. Consider configuring the spec during configuration time, or using a separate task to do the configuration. – mystdeim Jan 12 '17 at 17:29
  • Not sure what you actually did, I edited the answer to make clear, what I have shown is the configuration closure of the task. – Henry Jan 12 '17 at 19:26