Exclude folder doesn't work in Jar task

Hi we have the following source folder structure:

com
--test
----internal
----foo
------internal
----bar

and we want to create an api jar file with the following task:

task jarApi(type: Jar) {
      from compileJava
      exclude '**/internal/**'
      includeEmptyDirs = false
      classifier = 'api'
    }

Our problem is that the generated jar file includes some internal folders but not all. Am I missing something? I also tried to set the includes and excludes properties and this also doesn’t work.

Thanks in advance.

Guy

I don’t see anything wrong with your code (except that ‘from compileJava’ won’t include any resource files), and it appears to work fine for me. Can you provide a self-contained build that allows us to reproduce the problem? Also, can you post the output of ‘gradle -v’?

I found the problem while creating the self-contained build. Sorry for the inconvenience.